How to have Excel buttons call a function with a parameter passed in Visual Basic for Applications?
Posted on 2011-03-22
I have a macro that creates buttons into my Excel sheet, and these buttons must call a macro. The difficult problem is, I need to tell which button called the macro.
One way to do this is passing the button as a parameter, and then getting it's ID (or row index):
Sub ArchiveTradeMacro(ByVal oButton As CommandButton)
But when I create the buttons, I could only set it to call a macro without parameters... I can't call a macro while passing itself as a parameter.
So there's must be a way to do this.