macros changing to modules?

J

J.W. Aldridge

I have a workbook with a load of macros that i recorded and programmed
some time ago.
Recently, i began having problems with them running as usual....

I looked over the macro list and found that several of the maco's have
turned into modules.
The ones that have, have doubled themselves (module 3 and module 16).

The problem is that some references to the codes that have doubled
themselves are now changing.

Any reason for this?
I am having to go back and delete one, and rename the other one by
removing the term "module".

Any clues?
 
C

Cringing Dragon

The only time I can think that macros would actually "turn into modules"
would be if you have upgraded from a rather old version of Excel (pre Excel
97 I think). Old Excel 4 macros were on "macro sheets" instead of in modules.
For more recent versions, macros are stored in modules, although if you've
only ever recorded and replayed them then you might not have been aware of
that.

If your macros were old-style Excel 4 macros, then the following articles
might help explain the change:

http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/office97/html/web/appa.asp

http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/office97/html/web/001.asp

But assuming that they were created in Excel 97 or later...
A module is simply a holder for macros (and other sorts of procedures). If
you start up the Visual Basic Editor you'll be able to see all the modules in
your project (workbook) in a folder-like list on the side. Most of the time,
the module name doesn't really matter - the macro name is determined by the
Sub line in the code (eg Sub Macro1() indicates the beginning of a macro
called Macro1). There can be more than one macro in each module. The module
name does matter if you have more than one macro with the same name in the
same project (workbook) - then you need to use the module name as well as the
macro name to tell them apart (I'm guessing that's what's just happened to
you, and why you now see the module name when you didn't before). If all your
macros are recorded macros, they should all have had different names so the
module shouldn't matter (the macro recorder is generally clever enough to
default to a name that does not already exist, but if you type in a name then
you potentially could cause a double up). If you are now getting duplicates
of the same macro name in different modules appearing in your macro list,
then maybe one of the modules got copied (I don't know how that would happen
accidentally).
If you want more info, the following link is a bit of a guide to programming
in VBA - it was written for Office 97, but it seems to be a better beginner's
guide than the more recent stuff I've seen.
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/office97/html/web/FULLTOC.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top