two consescutive finds
recently while trying to find solution I have to configure two consecutive
finds. further on when i want to do findnext of the first find the programme
did findnext of only the second find and not the first one (sorry the
question has become convolute).some extract and comments are given below
the entries data and data1 are interspersed with some other data and the
entries data and data1 are repeated.
the code is something like this
Dim cellsfind As Range
Dim cellsfind1 As Range
Set cellsfind = Cells.Find("data", lookat:=xlWhole)
MsgBox cellsfind 'it is <data
Set cellsfind1 = Cells.Find("data1", lookat:=xlWhole)
MsgBox cellsfind1 'it is <data1
cellsfind1.Select
Set cellsfind = Cells.FindNext(cellsfind)
MsgBox cellsfind 'it is again data1 and not data which I thought it should
be as I used <cellsfind variable
code ends
where do I do the mistake.
ofcourse i solved the problem by a pedestrian and inelegant method of after
the first set of finds looping the same <find codes till the loop reaches
the end of the range (without using find next)
thanks and regards.
|