textbox

khatri milan

New Member
Joined
Nov 6, 2019
Messages
17
I have created some textbox in my worksheet and when i finish giving input to one textbox and press enter i want the cursor to move into another textbox .How can i do this?Please help.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Try this. Replace TextBox1 and TextBox2 with the names of your Textboxes.
VBA Code:
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
        If KeyCode = 13 Then
             TextBox2.Activate
        End If
End Sub
 
Upvote 0
to activate this sub , i will again need a command button ,so it is not easy than using mouse to move into another text box,no?
 
Upvote 0
Have you tried it out? When you are finished with the input of the first textbox and you press enter, it will move to the second textbox.
 
Upvote 0
Ah I see the misunderstanding. I assumed it was ActiveX textbox, which the code works for. I am actually not sure if you can do it with a formcontrol textbox. I'll have to check that.
 
Upvote 0
Thank you verymuch, initially i was writing these code on a module and it didnot work but when i wrote same code in the coding window of sheet containing those textboxes, it worked fine. I appreciate your help verymuch.
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,172
Members
449,071
Latest member
cdnMech

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