Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
display the textbox by clicking a cell tkraju via OfficeKB.com Excel Discussion (Misc queries) 0 November 4th 09 06:13 PM
How to Run a Macro from clicking a cell Romileyrunner1 Excel Worksheet Functions 11 September 20th 09 01:19 PM
Run a macro after clicking into cell Esradekan Excel Worksheet Functions 6 March 27th 08 10:34 PM
Using Macro to sort without clicking on macro button dd Excel Discussion (Misc queries) 3 May 3rd 07 06:00 PM
Clicking the text in a textbox erases all the data in the box dok112[_20_] Excel Programming 4 July 27th 04 01:26 PM


All times are GMT +1. The time now is 09:47 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"