Private Sub cb2_Click()
' Put your code here
End Sub
That's kind of a relative question, because it's entirely dependent upon what you're trying to do. If you have written or recorded a macro and you want it to be triggered when a button is clicked, then copy that code and put in place of 'Put your code here.I guess what I needed to know is what is the code that needs to go in the spot where you have ' Put your code here .
Private Sub CommandButton1_Click()
UserForm1.Show
End Sub
How do I make the part in quotes dynamic?If you want to run a macro already saved inyour macros in excel then use this:
Application.Run "'Nameofspreadsheet'!NameOfMacro"
K.
Application.Run Sheetname!Macroname
Unfortunately that doesn't work. I get a "Compile error: Expected: end of statement" when I try that.Have you tried:
Application.Run Sheetname & "!" & Macroname