1004 error troubleshooting

LactoseO.D.'d

Board Regular
Joined
Feb 22, 2010
Messages
52
I have a hidden worksheet that copies itself and creates a new worksheet. On the worksheet I have a command button that I have assigned a macro to:

Code:
Private Sub CommandButton3_Click()
    Call MacroName
End Sub

However, I have an issue as to where I store the Macro. Though the macro executes, it only does so if the code for it is stored on the worksheet object. This gives a 1004 error because the macro itself references another worksheet. When I put the macro in a module and tried making the macro global, the reference to it on the command button no longer works. How do I fix this?
 
Yes it is. It shouldn't be a security issue since the only macros most people run are developed in house. Are there serious shenanigans that can happen if you trust access to the vba project object model?
 
Upvote 0

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Yes there could be security implications.

I don't know exactly what they might be and could depend on your setup.

There's also the hurdle of organisation policy.

You might be able to do something with signed certificates, but why not see if there's some way to do what you want without programming the VBE.
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,299
Members
452,904
Latest member
CodeMasterX

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top