View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default goto statement in VBA

as many lines as you want.

if A = B then goto label1
LineA
LineB
LineC
LineD


Label1:
Line1
Line2
Line3
Line4

Usually it is better to do

if A < B then
LineA
LineB
LineC
LineD
End if

Line1
Line2
Line3
Line4


--
Regards,
Tom Ogilvy


"Laurie" wrote:

Hi everyone who may help,

I am trying to use the goto statement in VBA in Excel.

From the Help, goto statement can jump to a label line.

I am wondering that, under the label line, which the goto statement jumps
to, how many statements are allowed?

In the help, only one line of statement is under the label line. Can there
be a block of statements under the label line?

Any help would be really appreciated.

Thanks a lot,
Laurie