Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe you should be using the FindNext method:
myRange = Range("WhateverYouWant") With Worksheets(1).Range(myRange) Set c = .Find(2, lookin:=xlValues) If Not c Is Nothing Then firstAddress = c.Address Do c.Value = 5 Set c = .FindNext(c) Loop While Not c Is Nothing And c.Address < firstAddress End If End With "David" wrote: Hi again, I got part of this, but it is part of a loop. I was able to select the cell in the first instance of the find, but when the loop goes around again, it fails. The loop includes the Set and Find again, but the FoundCell has nothing in it at this point, so it can not be activated. New Code: Dim FoundCell As Range Set FoundCell = Selection.Find(What:="ORDER:", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False) Range(FoundCell.Address).Activate <-This is now where it fails. -- David "David" wrote: Hi group, I am doing a find for text. I thought i had to Set as a range, then do the "Find" then select it, but I am getting an error. This is the code I have that produces the Error: Dim FoundCell As Range Set FoundCell = Selection.Find(What:="ORDER:", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate Any help would be appreciated. -- David |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA: Column Select then Data Select then return to cell A1 | Excel Discussion (Misc queries) | |||
Macro to select cells without a certain value and select a menu it | Excel Worksheet Functions | |||
End Select without Select Case, Block If without End If errors | Excel Programming | |||
In Excel 2000, How do you select the whole of a worksheet (Select. | Excel Discussion (Misc queries) | |||
In Excel 2000, How do you select the whole of a worksheet (Select. | Excel Discussion (Misc queries) |