View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_2263_] Rick Rothstein \(MVP - VB\)[_2263_] is offline
external usenet poster
 
Posts: 1
Default goto statement in VBA

There is no practical limit for how many statements can be in the block
following the GoTo statement. With that said, you will do yourself a big
favor if you learn not to use the GoTo statement (it makes code much harder
to read, especially several months from now when you come back to edit your
code). With the exception of On Error GoTo error handler, there is almost no
situation where GoTo is the correct solution. You can usually almost always
use an If-Then-Else or Select-Case block structure instead. Why don't you
outline what you are trying to code using GoTo and let's see if someone here
can show you a better way to code it.

Rick


"Laurie" wrote in message
...
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