Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
GoTo won't work - why?
In a sub
TryAgain: (some code) Application.GoTo TryAgain (more code) End Sub I never use GoTo statements except for error handling so I wonder if they will backup as well as skipping lines? I really need this thing to back up. When running, the Application.Goto TryAgain line is skipped as if it isn't there. Not even an error. What's up? Thanks for any help. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
GoTo won't work - why?
It will not stop at the label, but should execute the first line after the
label. TryAgain: MsgBox "This line executes 'More code Application.GoTo TryAgain: "Jim" wrote: In a sub TryAgain: (some code) Application.GoTo TryAgain (more code) End Sub I never use GoTo statements except for error handling so I wonder if they will backup as well as skipping lines? I really need this thing to back up. When running, the Application.Goto TryAgain line is skipped as if it isn't there. Not even an error. What's up? Thanks for any help. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
GoTo won't work - why?
I fixed it. I changed Application.Goto TryAgain to just Goto TryAgain but
this didn't work either. I closed Excel and restarted it. Now it works. "Jim" wrote in message ... In a sub TryAgain: (some code) Application.GoTo TryAgain (more code) End Sub I never use GoTo statements except for error handling so I wonder if they will backup as well as skipping lines? I really need this thing to back up. When running, the Application.Goto TryAgain line is skipped as if it isn't there. Not even an error. What's up? Thanks for any help. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
GoTo won't work - why?
I fixed it. I changed Application.Goto TryAgain to just Goto TryAgain Goto and Application.Goto are completely unrelated. Application.Goto scrolls to and display a location on a worksheet. VBA's GoTo moves the execution point in code. Just as an aside, I would try to eliminate the need for a Goto statement and make your code more structured and modular. Goto is universally considered a very poor coding practice by professional developers. One or two Gotos may be harmless, but code with lots of Goto jumps make debugging, maintenance, and expansion quite difficult. You don't want to get in the habit of using Gotos. They are bad news. Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Sat, 28 Feb 2009 22:43:45 -0600, "Jim" wrote: I fixed it. I changed Application.Goto TryAgain to just Goto TryAgain but this didn't work either. I closed Excel and restarted it. Now it works. "Jim" wrote in message .. . In a sub TryAgain: (some code) Application.GoTo TryAgain (more code) End Sub I never use GoTo statements except for error handling so I wonder if they will backup as well as skipping lines? I really need this thing to back up. When running, the Application.Goto TryAgain line is skipped as if it isn't there. Not even an error. What's up? Thanks for any help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
On Error GoTo Doesn't Work | Excel Discussion (Misc queries) | |||
On Error GoTo Doesn't Work | Excel Programming | |||
Goto | Excel Programming | |||
On Error Goto doesn't goto | Excel Programming | |||
On Error Goto doesn't goto | Excel Programming |