View Single Post
  #18   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default First Time VBA user- really easy question :-)

Good to hear that you've got it working.

As a general rule, I only put those worksheet events and code for the controls
inside a worksheet's module.

I sometimes break that rule if there is a sub/function that will only be called
by one of those procedures. But if there's even the slightest chance that I'd
use that sub/function elsewhere, I move it to a General module.

cappy2112 wrote:

Your code is still in just a single file. It's in the project of that .xls
file. You can have multiple worksheets (each with its own code module). You
can have multiple General modules (nice for organization of procedures).

But unless you're really, really smart and organized, you don't want two
procedures that share the same name.


I wasn't suggesting this.

I'm not sure what you mean by the worksheet didn't run anymore when you moved
the code.


Well, ALl of the event handlers for the worksheet were moved to the
general module, so what's left are no event handlers.
I never got the reply from Chip about putting all of the code in the
general module, or just the one for the version number, so I tried it
both ways. Now I see that's wrong, and I'm on an even keel now.

Maybe you moved code that's associated with events or controls from the control
toolbox toolbar that are placed on that worksheet.

Exactly.

It's still difficult to tell since you haven't shared that code.

It's code from my work, I can't post that. Yes, I know it makes it
extremely hard to give advice when you can't see the code, but you've
got me back on track.


--

Dave Peterson