Solved

Assign macro to existing button in Excel 2010+

Posted on 2014-02-02
12
1,819 Views
Last Modified: 2014-02-03
Hi,

MS has moved things around so much I can't find this simple thing.  I have an existing button and macro.  I want to assign the macro to the button.  I don't want to create a new button, but use the existing button.

When I have a brand new button I can right-click and it has the option to 'Assign-Macro'.  I don't have that option on this button, and it doesn't seem to be running the macro, so I want to reassign.

How do I assign an existing macro to an existing button?

Thanks!
0
Comment
Question by:ugeb
  • 5
  • 4
  • 2
  • +1
12 Comments
 
LVL 46

Assisted Solution

by:Martin Liss
Martin Liss earned 100 total points
ID: 39828577
Right-click on the button and choose Assign Macro
0
 
LVL 18

Accepted Solution

by:
Steven Harris earned 400 total points
ID: 39828578
You should be able to use right-click > assign macro.

assign macro
Then pick where the macro is located (this workbook, etc.):

macro location
0
 
LVL 11

Author Comment

by:ugeb
ID: 39828579
As I mentioned, I don't have that option on the button.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 18

Expert Comment

by:Steven Harris
ID: 39828581
If you already have a macro assigned, you will need to remove it.
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39828582
Can you attach your project and point out the button you are referring to?
0
 
LVL 18

Expert Comment

by:Steven Harris
ID: 39828583
Or you can just bypass it...

Right-click > view code... > change macro to:
Sub ButtonName_Click()
   macroname
End Sub

Open in new window

Where macroname is the name of the macro you want to run.
0
 
LVL 11

Author Comment

by:ugeb
ID: 39828584
That's part of the infuriating thing about Excel now that I can't figure out.  There is no macro assigned.  When I double click in design mode, it CREATES a stub. I delete the stub, but there is still no option to assign macro.

Also when I try putting in a print statement in the stub, it's not executed.  This is not an old spreadsheet, it's new.  (however it does have confidential info so I can't upload it).
0
 
LVL 18

Expert Comment

by:Steven Harris
ID: 39828602
When I double click in design mode, it CREATES a stub.

Correct.  

Easiest way is to divert using the example above or recreate the button.  Click Cancel when prompted to make a macro, then use the right-click it as shown above.
0
 
LVL 11

Author Comment

by:ugeb
ID: 39828621
Yes, but my point is the stub code is not even executed so there is no diversion possible.  I also don't want to delete the button.

Right clicking gives nothing appropriate.
0
 
LVL 18

Expert Comment

by:Steven Harris
ID: 39828638
I'm going to have to reiterate Martin's question then:

Can you attach your project and point out the button you are referring to?  Even if you save down a limited function copy where only the button and the code exists, removing all sensitive info.
0
 
LVL 11

Author Closing Comment

by:ugeb
ID: 39829017
I actually knew how to do all this stuff, but it didn't work for me, which is why I asked for help here.  I was hoping someone had other ideas because maybe it was just the difference between Excel 2007 and 2010 that was messing me up.  That certainly contributed, but wasn't the real problem.

I think that somehow in my spreadsheet's short life it started hanging out with the wrong crowd and got corrupted.  I can't help but feel partly responsible for its errant ways, but I deleted that bad button.  It crashed Excel, but the recovered file had the juvy deleted.  I didn't want to, but I was forced to create a new button and reformat and align etc., but at least it works now.

Thanks for helping.
0
 
LVL 33

Expert Comment

by:Norie
ID: 39829888
Sounds like you might have an ActiveX button instead of a Forms button.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question