Using (Chr$(13)) to submit data in a TextBox (SOLVED)

phantom1975

MrExcel MVP
Joined
Jun 3, 2002
Messages
3,962
I tried this and it won't work:

Private Sub TextBox1_Change()
Application.Onkey "{ENTER}" Or "~","Macro1"
End Sub

Basically, after the user enters data into the TextBox and hits the either ENTER key, I want to run Macro1.

What should I do instead?


_________________
Pass on what you have learned. Support this great website by clicking on the sponsor's ads!.
This message was edited by phantom1975 on 2002-08-22 23:38
This message was edited by phantom1975 on 2002-08-23 01:20
 
On 2002-08-23 01:20, phantom1975 wrote:
I just found what I am looking for!

Private Sub TextBox1_KeyDown()

If Keycode = 13 Then
Unload Me
UserForm2.Show
End Sub

Shouldn't that be ??
<pre/>
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

End Sub
</pre>
 
Upvote 0

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Yes, it is. I am doing my code on my laptop and my questioning on my home computer. Can't dial up with my laptop. I was just too lazy to type the whole thing out! Thanks for catching it Ivan!
 
Upvote 0

Forum statistics

Threads
1,224,803
Messages
6,181,055
Members
453,014
Latest member
Chris258

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