reference must be to a macro sheet

itlsbu

Board Regular
Joined
Jul 2, 2002
Messages
102
hello,

I have a simple macro (see below). When I try to assign it to a button, I get the message "reference must be to a macro sheet". Never had that before and even after searching for a hour I have no idea what I have done wrong or what it is I am missing.

Help would be appreciated

Sub EW1()
'

ActiveSheet.Unprotect
Columns("A:E").Select
Range("E1").Activate
Selection.EntireColumn.Hidden = False

End Sub

thanx steven
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hi Steven

Cell addresses are not valid names in the worksheet environment.

Try for example to use the macro recorder to create a macro named A1 or D4 (or EW3) and you'll get the error message "Name is not valid."

Rename the macro.

Hope this helps
PGC
 
Upvote 0
PGC,

Thanx for the response, I did not know that, I will try it
In the meantime I copied the macro in a existing module and than it did work...

anyway thanx for the reply

steven
 
Upvote 0
Hi again

In the meantime I copied the macro in a existing module and than it did work...

Yes, in a module there's no problem, you can have a macro called A1.

As I said the problem arises in the worksheet environment.

Kind regards
PGC
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,044
Members
449,063
Latest member
ak94

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