Macro question. help me make the enter key triger macro

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
is there i way I can make the enter key triger the macro after i write/paste the name on the activex textbox1. Thank you.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Have considered maybe placing a Commandbutton under your textbox1 with the Caption Run Macro

Code:
Private Sub CommandButton1_Click()
Dim s As String
s = TextBox1.Text
Run s     'calls any Macro previoulsy set up (in Module1) with this name
End Sub
 
Upvote 0
Have considered maybe placing a Commandbutton under your textbox1 with the Caption Run Macro

Code:
Private Sub CommandButton1_Click()
Dim s As String
s = TextBox1.Text
Run s     'calls any Macro previoulsy set up (in Module1) with this name
End Sub


i'M not very good in this macro thing.
So the macro in the textbox will triger the macro in the command button?

now i make my macro run when i hit the command button.
 
Upvote 0
As you requested - type or paste into your textbox a Macro name. This text in the Box is just text - it will stay there until you overwrite it with other test (another macroname) or close the form. Nothing will happen (a macro will not be triggered) by pressing the enter key within the textbox.

You need to ADD a new control - an Active-X CommandButton with the Caption "Run Macro" - and the code I provided you should be associated with this button. When you Click the CommandButton you are telling Excel to Run a Macro that has that name.
 
Upvote 0

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top