button awareness. i dont know if it can be done.

  • Thread starter Thread starter cdde
  • Start date Start date
C

cdde

can you make a macro assigned to button aware of where that button is?

i want to use the same macro for all 250+ buttons i will hav
associated to the row its placed on.....so i need the macro to be awar
of what button triggered the macro and not to repeat the macro for al
buttons.

on top of that....i need the macro to beable to know where the butto
is.....on what column and what row....if you need my code o
spreadsheet i can post it....thanx
 
That is a bunch of buttons dude! And all buttons will run the same macro? Is
that all the buttons will do? If so, there must be a simpler way to do what
you want. Please post what data is in your sheet and what you want to do
with it, and any code you have.

Thnx..Mike F
 
Try something like this! (put this in your auto_open module)

With Application
.CommandBars("name of your commandbar").Controls("name of you
button").OnAction = "name of your macro"
End With

Hope this helps

Simo
 
Look at "application.caller" then use that value to find the button
(use buttons from the forms collection, not the control toolbox)

Sub FindMe()

Dim sName
Dim s

sName = Application.Caller
Set s = ActiveSheet.DrawingObjects(sName)
MsgBox s.TopLeftCell.Address(False, False)

End Sub

Tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top