Run one Macro from clicking different Textbox Objects
Steve,
You should have a macro for each textbox, in which you call your main macro with a passed
parameter(s). For example, assign TB1 to Text Box 1, etc...
Sub TB1()
MainMacro ActiveSheet.TextBoxes("Text Box 1").Text
End Sub
Sub TB2()
MainMacro ActiveSheet.TextBoxes("Text Box 2").Text
End Sub
Sub MainMacro(myT As String)
MsgBox "Macro fired by textbox with the text """ & myT & """"
End Sub
HTH,
Bernie
MS Excel MVP
"SIR Knight" wrote in message
oups.com...
Hi,
I have a spreadsheet with a flowchart (created using Textboxes). I
have written some code that looks at the text content of the textbox
and performs actions based on the text. The question is:
How do I get the Macro to identify the textbox object I have clicked?
Eg. If I click on TextBox1 the macro recognises the content of
TextBox1, and if I click on TextBox2 recognise content of TextBox2 etc.
All help greatly appreciated
Thanks
Steve
|