Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Got to endorse Tom's wise words. IMO it is a weakness of VBA that we need
goto's for error handling, a throwback to older Basics I guess. I once worked on a electoral roll application written in Cobol, a version of Cobol that allowed alterable gotos. Can you imagine the nightmare of trying to debug that. Bob "Tom Ogilvy" wrote in message ... Generally, if you examine the logic of your task, your code can fit into the IF ... Then or Case construct. Using GoTo makes your code much more difficult to read - go back and look at some complex code you haven't looked at in a month or two and see if you can easily understand your logic. This it the advantage of a) using structured programming b) documenting your code. c) coding in blocks and using subroutines and functions There may be cases where a goto or exit is necessary, but you should employ them minimally and not as standard practice. Perhaps your response it that the code is only for you, but you seem to post a lot of it up here and want people to understand it. -- Regards, Tom Ogilvy "Hari Prasadh" wrote in message ... Hi Bernie, Thnx a lot. Would use it for my purpose. Your method of Skipout reminds me of On Error go to ...method, which I learned recently. Thanks a lot, Hari India "Bernie Deitrick" <deitbe @ consumer dot org wrote in message ... Hari, Maybe something like: For i = 1 To Alot If Something Then GoTo SkipOut 'code here If SomethingElse Then GoTo SkipOut 'or code here If Not StillSomethingElse Then GoTo SkipOut 'other code here SkipOut: Next i HTH, Bernie MS Excel MVP |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
count rownumbers in loop | Excel Discussion (Misc queries) | |||
loop count | Excel Discussion (Misc queries) | |||
Jump out of Do Loop on sheet change | Excel Programming | |||
End loop macro with count | Excel Programming |