How is this?:
Range("V38,V45,V52,V58,V65,V72,V78,V84").Select
If Range("AG21").Value = "N" And ActiveCell <> "Tony" Then
Selection.Find(What:="Alternate", After:=ActiveCell, LookIn:
=xlFormulas,
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.FormulaR1C1 = "Tony"
ElseIf Range("AG24").Value = "N" And ActiveCell <> "Robert" Then
Range("V12,V17,V24,V28,V34,V38,V44,V50,V57,V63,V69,V74,V79,V85").
Select
Selection.Find(What:="Alternate", After:=ActiveCell, LookIn:
=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.FormulaR1C1 = "Robert"
End If
>Would you care to try again - and perhaps post some code?
>
[quoted text clipped - 9 lines]
>> replace it with a name. The problem is that if it does not find the word
>> "Alternate" the macro doesn't run. Help!
Tony Jollans - 15 Oct 2005 13:46 GMT
This is an Excel problem and would be better asked in an Excel group.
In brief, you cannot Activate a cell which hasn't been found and you need to
do something like ..
Set TempRange = Selection.Find(etc...=False)
If not TempRange is nothing then Temprange.Activate
--
Enjoy,
Tony
> How is this?:
>
[quoted text clipped - 32 lines]
> Message posted via OfficeKB.com
> http://www.officekb.com/Uwe/Forums.aspx/word-programming/200510/1
What I want with this is to find any cell that has "Alternate" in it and
replace it with Tony. If there are not any "Alternate" cells, then I want to
continue on with the next part of my macro.
>Would you care to try again - and perhaps post some code?
>
[quoted text clipped - 9 lines]
>> replace it with a name. The problem is that if it does not find the word
>> "Alternate" the macro doesn't run. Help!