View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Too many gotoos?

I always I appreciate getting some thanks so I would say you did something
right... You are correct in saying that Goto s are in general a NoNo. The
only place they are appropriate IMO is for error handling. With proper coding
styles you can ALWAYS eliminate the need for goto s. The problem with Goto's
is that they get to be impossible to debug when they start looping back on
themselves and they are very prone to getting into inifinite loops.

(The other exception to the Goto rule might be Application.Goto
Referece:=??? but with the use or range objects they are of little value IMO).

That's my 2 cents...
--
HTH...

Jim Thomlinson


"davegb" wrote:

The following code creates a spreadsheet by getting user input on the
"Facility Name" and the number of clients that facility served during
the month. The user fills in the blank fields after filling out the
form. The macro creates the nearly blank rows for the data and a row of
subtototals. When the user clicks "Cancel", the macro puts in a row of
Overall Totals at the bottom. It works fine. But it uses 3 Goto
commands (it had 5 before I cleaned it up a bit) and I understand gotos
are no-nos for good coding. I'm interested in feedback to see if
there's a way to use less of them. Two of the three are for error
handling in case the user failed to enter both required pieces of data.


I'm also interested in any other input on my coding. Thanks to anyone
who gives me feedback, and even more thanks if you think I did
something right! :)