2 Combo Boxes, using TAB to change active

hapaboy03

New Member
Joined
Oct 20, 2013
Messages
5
I'm currently using 2 combo boxes setup from this website http://www.contextures.com/xlDataVal11.html

In column B, I'm using it to pull from a list of names. I'm looking to be able to TAB from column B, to column C were I have a list of positions. I've tried inserting more code under the keycode for TAB at the end, but haven't had any luck.
 
Still looking if there's anyone who could in regards to helping me focus from tabbing onto a 2nd combo box being created over a data validation list in column C, from column B. Any help would be grately appreciated...

here's the code from the website previously mentioned:


Code:
'==========================
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _  Cancel As Boolean)Dim str As StringDim cboTemp As OLEObjectDim ws As WorksheetSet ws = ActiveSheetSet cboTemp = ws.OLEObjects("TempCombo")  On Error Resume Next  With cboTemp  'clear and hide the combo box    .ListFillRange = ""    .LinkedCell = ""    .Visible = False  End WithOn Error GoTo errHandler  If Target.Validation.Type = 3 Then    'if the cell contains a data validation list    Cancel = True    Application.EnableEvents = False    'get the data validation formula    str = Target.Validation.Formula1    str = Right(str, Len(str) - 1)    With cboTemp      'show the combobox with the list      .Visible = True      .Left = Target.Left      .Top = Target.Top      .Width = Target.Width + 5      .Height = Target.Height + 5      .ListFillRange = str      .LinkedCell = Target.Address    End With    cboTemp.Activate    'open the drop down list automatically    Me.TempCombo.DropDown   End If  errHandler:  Application.EnableEvents = True  Exit SubEnd Sub'=========================================Private Sub Worksheet_SelectionChange(ByVal Target As Range)Dim str As StringDim cboTemp As OLEObjectDim ws As WorksheetSet ws = ActiveSheetApplication.EnableEvents = FalseApplication.ScreenUpdating = TrueIf Application.CutCopyMode Then  'allow copying and pasting on the worksheet  GoTo errHandlerEnd IfSet cboTemp = ws.OLEObjects("TempCombo")  On Error Resume Next  With cboTemp    .Top = 10    .Left = 10    .Width = 0    .ListFillRange = ""    .LinkedCell = ""    .Visible = False    .Value = ""  End WitherrHandler:  Application.EnableEvents = True  Exit SubEnd Sub '===================================='Optional code to move to next cell if Tab or Enter are pressed'from code by Ted Lanham'***NOTE: if KeyDown causes problems, change to KeyUpPrivate Sub TempCombo_KeyDown(ByVal _        KeyCode As MSForms.ReturnInteger, _        ByVal Shift As Integer)    Select Case KeyCode        Case 9 'Tab             ActiveCell.Offset(0, 1).Activate        Case 13 'Enter             ActiveCell.Offset(1, 0).Activate        Case Else            'do nothing    End SelectEnd Sub '====================================
 
Last edited:
Upvote 0
What is the result when you try to use Tab and Enter in the current code?
 
Upvote 0
currently, enter will take it to the next line. tab will focus over to column C, but only to the data validation list, not the popo up combo box. i've tried to call the before click event but no luck.
 
Upvote 0
The ComboBox is only made visible on the BeforeDoubleClick event. To do what you are after you'd need to test for either a specific position or the existence of data validation in the Worksheet_SelectionChange event and set the ComboBox there.
 
Upvote 0

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