Tabbing through list boxes

RedJames

Board Regular
Joined
Jun 3, 2014
Messages
67
Hello,

I am creating a form in Excel 2007/XP. I have a series of list boxes that I would like users to be able to tab and type to make selections. Right now when I hit tab (or an arrow key) while in the list box it does nothing. Anyone know if it is possible to tab from one list box to the next?

Thanks!
 
Sorry, one more question. How would I change that code if I wanted to tab from a list box to a cell?
 
Upvote 0

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Sorry, one more question. How would I change that code if I wanted to tab from a list box to a cell?
Change the If..Then block for the "last" ListBox to this...
Code:
  If KeyCode = vbKeyTab Then
    ActiveCell.Select
  End If
The above code reactivates the cell that was active when the fist ListBox was entered. If you have a particular cell you want activated instead, for example A1, then change ActiveCell to a reference to that cell...

Range("A1").Select
 
Upvote 0
I am trying to invert this code to go from a cell to a list box. I have tried this, but it doesn't work. It is wanting me to change something about the ("B14") Any thoughts?

Code:
Private Sub Range("B14")_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = vbKeyTab Then
    Me.ListBox5.Activate
  End If
End Sub
 
Upvote 0
I would also love to be able to take this code:

Code:
Private Sub ListBox5_Click()
Dim IsYes As Boolean
IsYes = Me.ListBox5.Value = "Yes"
Me.ListBox6.Enabled = IsYes
Me.ListBox7.Enabled = IsYes
End Sub

and if yes, tab into list box 6, If no tab to List Box 9.


I know I'm asking a lot, but I do REALLY appreciate all the help!
 
Upvote 0
It keeps highlighting the "B14" in this code and giving the compile error "expected: identifier" I'm really confused at why this is not a valid identifier.

Code:
Private Sub Range("B14")_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = vbKeyTab Then
    Me.ListBox5.Activate
  End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,222,653
Messages
6,167,370
Members
452,111
Latest member
NyVmex

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