Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Will this get in a continual loop if "a" never equals "linkno"?
With rng Set xcell = .find(what:=drwno, LookIn:=xlValues, LookAt:=xlWhole, _ SearchOrder:=xlByColumns) a = xcell.Offset(0, 10).Value MsgBox ("a = " & a) If a < linkno Then Do Set xcell = .FindNext(xcell) a = xcell.Offset(0, 10).Value Loop While a < linkno End If End With Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Will this get in a continual loop
Looks like it. What you want to do with the Find method is stop when you're back to the first hit, since Excel will just keep finding the same cells. So get the address of the first hit and then break out of the loop if a = linkno or the address of xcell = the address of the first hit. -- Jim "ranswert" wrote in message ... | Will this get in a continual loop if "a" never equals "linkno"? | | With rng | Set xcell = .find(what:=drwno, LookIn:=xlValues, | LookAt:=xlWhole, _ | SearchOrder:=xlByColumns) | a = xcell.Offset(0, 10).Value | MsgBox ("a = " & a) | If a < linkno Then | Do | Set xcell = .FindNext(xcell) | a = xcell.Offset(0, 10).Value | Loop While a < linkno | End If | End With | Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks I'll give that a try
"Jim Rech" wrote: Will this get in a continual loop Looks like it. What you want to do with the Find method is stop when you're back to the first hit, since Excel will just keep finding the same cells. So get the address of the first hit and then break out of the loop if a = linkno or the address of xcell = the address of the first hit. -- Jim "ranswert" wrote in message ... | Will this get in a continual loop if "a" never equals "linkno"? | | With rng | Set xcell = .find(what:=drwno, LookIn:=xlValues, | LookAt:=xlWhole, _ | SearchOrder:=xlByColumns) | a = xcell.Offset(0, 10).Value | MsgBox ("a = " & a) | If a < linkno Then | Do | Set xcell = .FindNext(xcell) | a = xcell.Offset(0, 10).Value | Loop While a < linkno | End If | End With | Thanks |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Just to make a point... it took 1 hour 6 minutes for you to get an answer to
your question and another 34 minutes after that for you to see that answer. You could have gotten an instaneous answer to your question if you had placed your cursor on the word FindNext in your code and pressed F1 to evoke Help for it... the Help file that would have come up for this method explains the problem you raised in its Remarks section and gives a code example on how to get around the problem. Rick "ranswert" wrote in message ... Thanks I'll give that a try "Jim Rech" wrote: Will this get in a continual loop Looks like it. What you want to do with the Find method is stop when you're back to the first hit, since Excel will just keep finding the same cells. So get the address of the first hit and then break out of the loop if a = linkno or the address of xcell = the address of the first hit. -- Jim "ranswert" wrote in message ... | Will this get in a continual loop if "a" never equals "linkno"? | | With rng | Set xcell = .find(what:=drwno, LookIn:=xlValues, | LookAt:=xlWhole, _ | SearchOrder:=xlByColumns) | a = xcell.Offset(0, 10).Value | MsgBox ("a = " & a) | If a < linkno Then | Do | Set xcell = .FindNext(xcell) | a = xcell.Offset(0, 10).Value | Loop While a < linkno | End If | End With | Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Loop to Filter, Name Sheets. If Blank, Exit Loop | Excel Programming | |||
Naming Worksheets - Loop within a loop issue | Excel Programming | |||
Naming Worksheets - Loop within a loop issue | Excel Programming | |||
Advancing outer Loop Based on criteria of inner loop | Excel Programming | |||
Problem adding charts using Do-Loop Until loop | Excel Programming |