View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
JLatham JLatham is offline
external usenet poster
 
Posts: 2,203
Default Which macro module

If memory serves me right, this is the way things usually work for me:
First time I create a macro in a new 'session' with a workbook, a new module
is created. Then all macros recorded during that session are added to that
new module. If I start a session with Module1, Module2 and Module3 already
in it, if I record a new macro, it ends up in Module4 along with any more I
might record after that but before closing the workbook.

But I'm also with Luke M on this one - I don't like the extra overhead of
having 1 Module for every macro, so I usually move them all into one module,
giving each macro an unique name that has the nice side effect of making it
very easy to determine what their purpose is when viewed in the Tools | Macro
| Macros menu list.

But again, if your method of organization works for you, then continue with
it, but Excel is going to be rather uncooperative when you record multiple
macros during a single session with a workbook.

Note that I don't necessarily have just one huge Module in a workbook - I
often segregate macros by either function (such as putting all sorting macros
into one module) or by the worksheet(s) they operate on. I especially use
this method when writing VBA code to automate a workbook.

"wal50" wrote:

Thanks for the response Luke. Two different organization ideas I guess.
I'll have to think about your method.

Right now, I have each macro in a separate module and renamed it through
Properties so I can find/open it easily. Seemed easier to me but different
strokes...

I did describe the situation slightly incorrectly. All new (recorded)
macros go to the end of the same pre-existing module. It was one that had
been Module1 and I renamed it. I'll try renaming it Module1; move what's
there to another module and see what happens.

I appreciate all the help I've gotten from this site.

wal50
"Luke M" wrote:

When I try to replicate your situation, all my recorded macro go into the
same module (at the end). This would seem to make it rather easy to find.

On another note, it would be better to have multiple macros in 1 module,
then vice versa. Simply creating a module takes up file space. Generally you
would use a seperate module if you needed distinct declarations declared, not
for organization. Remember, you can easily do a quick Find to locate a macro,
or simply choose it from the drop down.

It is also easier for cleanup having fewer modules, as they can not be
simply deleted with a single keystroke.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"wal50" wrote:

At one time, a recorded macro would create a new module (module1). I could
find it, alter it and rename it something meaningful. Did that all the time.

Now any recorded macro goes to the end of a previously existing macro. It
seems to be the last macro that I had open before recording another one. I
have no idea what I did to accomplish this but it is annoying and if I don't
remember the last thing I did - time consuming.
Any ideas on getting this back to where it was.
Thanks
wal50