Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't tab from controls to cells on a sheet & vice versa 1

Status
Not open for further replies.

tbarthen

Technical User
Jul 26, 2003
33
US
Hey, I was wondering if anyone can come up with a macro for the following problem:

I have a spreadsheet with 2 textboxes on it. So a user can enter data within these textboxes as well as enter data in cells on the sheet.

Some users have asked to make it possible to tab out of a textbox after entering data in it. Is there a simple way to do this? I set the tabkeybehavior of the textboxes to false, but that's only the first step. It no longer tabs 5 spaces, but I still need to be able to select the next cell (or listbox).
 
Hi,

How about something like this?

[Tab] from TextBox1 to TextBox 2
[Tab] from TextBox2 to A1
Code:
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
   If KeyCode = 9 Then ActiveSheet.TextBox2.Activate
End Sub
Private Sub TextBox2_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
   If KeyCode = 9 Then ActiveSheet.[a1].Activate
End Sub

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at faq222-2244
 
Beautiful, nice work, and so simple.

Thanks for the quick response too
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top