Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run one Macro from clicking different Textbox Objects
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
display the textbox by clicking a cell | Excel Discussion (Misc queries) | |||
How to Run a Macro from clicking a cell | Excel Worksheet Functions | |||
Run a macro after clicking into cell | Excel Worksheet Functions | |||
Using Macro to sort without clicking on macro button | Excel Discussion (Misc queries) | |||
Clicking the text in a textbox erases all the data in the box | Excel Programming |