Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Jumping out of loop with GoTo function
Hi people!
I would like to jump out of a Do loop using the goto statement e.g. Do Until condition While i= 0 And i < value if value = 1 GoTo Line1: End If Wend Loop Line1: Obviously this doesn't do anything, but is the structure correct and the code correct for the statements shown? Do I need to declare Dim Line1 as String. My program doesn't work and I think GoTo has something to do with it not working. I do not have the help file either. Thank you |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Jumping out of loop with GoTo function
If value = 1 Then 'Forgot the "Then"
GoTo Line1 'No colon needed here HTH Charles Andy wrote: Hi people! I would like to jump out of a Do loop using the goto statement e.g. Do Until condition While i= 0 And i < value if value = 1 GoTo Line1: End If Wend Loop Line1: Obviously this doesn't do anything, but is the structure correct and the code correct for the statements shown? Do I need to declare Dim Line1 as String. My program doesn't work and I think GoTo has something to do with it not working. I do not have the help file either. Thank you |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Jumping out of loop with GoTo function
Hi Andy
If Line1: would be the next statement after Loop, you can use .... if value = 1 then Exit Do End If Wend Loop 'goes here if value = 1 ..... Avoid using Goto whenever possible, which is almost always. The only place it is still needed is "On Error Goto...." Len Andy wrote: Hi people! I would like to jump out of a Do loop using the goto statement e.g. Do Until condition While i= 0 And i < value if value = 1 GoTo Line1: End If Wend Loop Line1: Obviously this doesn't do anything, but is the structure correct and the code correct for the statements shown? Do I need to declare Dim Line1 as String. My program doesn't work and I think GoTo has something to do with it not working. I do not have the help file either. Thank you |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Jumping in a For ..Next Loop | Excel Programming | |||
On Error GoTo Label in a loop only working once. | Charts and Charting in Excel | |||
goto function | Excel Programming | |||
GOTO Using the ()NOW Function Q | Excel Programming | |||
GoTo Loop? | Excel Programming |