This is the code to add a button and assign a macro:
ActiveSheet.Buttons.Add(111, 51.75, 42.75, 13.5).Select
Selection.OnAction = "Macro1"
This is the code to add a button and assign a macro:
ActiveSheet.Buttons.Add(111, 51.75, 42.75, 13.5).Select
Selection.OnAction = "Macro1"
Best regards,
Ray
Thanks, Ray. That worked a treat. I added the line :
Selection.Caption = "UPDATE TOC"
and that names the button correctly.
I knew I would find a solution here.
Cheers!
Bruce
Bruce
The older I get, the better I used to be.
USA
I know I'm bringing this thread back from the dead but I have a slight problem.
I wrote a macro that does the following:
Create a button on a new sheet, assign it an onaction macro, then move it to a new workbook where the macro is added through a BAS file. Now unfortunately the onaction does not point to the correct macro. How can I fix it?
Thanks in advance!
Maxim
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks