Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error: The macro "macro name" cannot be found

Status
Not open for further replies.

rmo87

Programmer
Aug 8, 2007
3
US
I have an Excel document with a macro that refers to another spreadsheet that contains a created button (gray box), which in turn runs a macro when clicked.

I am trying to create a second version of these two spreadsheets with slight modifications.

The first macro runs OK, but I receive the following when Excel attempts to run the second macro: Run-time error '1004': The macro "full name here including the name and location of file" cannot be found.

If I then click 'Debug', it takes me to a line in Visual Basic highlighted in yellow: Application.Run "ABC.xls!macroname"

How do I get it to refer to the macro properly?
Thanks!
 
ensure that abc.xls is the correct file name that you are referring to and that "macroname" is the same as the macro you want to run

also ensure that the macro is in a standard module rather than a worksheet or workbook module

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 

Ok, I pretty much a novice with macros, so I'll need a little hand holding here. I believe I have a workbook module. How do I go about setting up the macro in a standard module?

Thanks for the help!
 


If the code is viewable when you click on "Workbook" in the VBE then you have the code in a workbook module

To insert a standard module, follow menu path: Insert>Module

Copy and paste the code into there and you should be fine

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top