Jack BeNimble
Jack BeNimble

Reputation: 36673

Excel VBA macro not found by worksheet, #NAME

I'm trying to get a simple VBA function to run in an excel (.xlsm) worksheet.

I created this function:

Function abc()

abc = 2

End Function

in Module2, and it worked.

But after I copied the spreadsheet to another system, it now just shows "#name" as if it can't find it. The function shows up on the available list of functions however.

This makes me think there is some kind of setting I need to enable, but I've enabled whatever I was prompted for. Any ideas?

Upvotes: 2

Views: 10665

Answers (2)

Jomtung
Jomtung

Reputation: 356

I think we may need more information. What version of Excel are you using? Is it different from the destination system version?

You'll want to make sure that Module2 was in the Workbook you copied into the other system. Excel 2007 stores macros on a personal workbook by default sometimes so you'll need to check the the code is actually inside of the .xlsm file.

If you're still stuck and need a quick fix just copy the code text into the new system's Excel workbook directly without making a .xlsm file (create new module in the other system then paste).

If you would like to learn how to put together add-ins you can get started here or here.

Upvotes: 0

Jack BeNimble
Jack BeNimble

Reputation: 36673

I should've known it was in the trust center:

http://office.microsoft.com/en-us/excel-help/change-macro-security-settings-in-excel-HP010096919.aspx

Basically, hit the ball and poke around until you find "trust" and "enable macros" and select the least secure options.

And then close and re-open the spreadsheet.

Upvotes: 2

Related Questions