View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Mark Mark is offline
external usenet poster
 
Posts: 989
Default Nested If's vs. GoTo statements

Instead of the GoTo, you could call subroutines. It would basically do the
same thing, in the end.... but it makes the code more modular, and therefore
easier to read. If you ever find out you don't need a certain piece, just
get ride of that subroutine, or if you need a new piece, just add a new
subroutine.

"Horatio J. Bilge, Jr." wrote:

I have a Worksheet_Change sub that originally had several levels of If
statements to do different things with different ranges ("If
Application.Intesect(Target,Range("A1:A10")) Is Nothing Then" ...).

It was making my head hurt to keep all of them straight, so I switched to
using GoTo statements, so I could separate the code for different ranges.
Then I read that using multiple GoTo statements is frowned upon as bad
practice, because it makes the code difficult to read.

I wanted to get the opinions of some experience programmers.
Any thoughts?
~ Horatio