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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
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,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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