We help IT Professionals succeed at work.
Get Started

VBA Code - How to tab from one TextBox to another so that after tabing the cursor is at the end of all the text in the next TextBox

FaheemAhmadGul
on
135 Views
Last Modified: 2019-12-08
On a VBA user Form I have two Text Boxes (named txtFirstName and txtLastName) and I frequently need to tab from one to another.

Currently when I tab from textbox to another all the text in the next Text Box gets selected. I would like to be able to tab to the next text box such that after pressing the tab key the cursor is at the of all the text in next TextBox.

I would appreciate help with how I set the properties of these Text Boxes so I achieve the above objective - that is after pressing the tab key when I get into the next textbox the cursor is at the end of all the text in the next text box.
If there is any VBA code which could enable such behaviour I would appreciate help with that also. Thanks.
I include an image to show what I am getting now and how I would like it to be.

Sample Image
Comment
Watch Question
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 2 Answers and 10 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE