+ Reply to Thread
Results 1 to 7 of 7

Need Help Coding ComboBoxes

Hybrid View

  1. #1
    Registered User
    Join Date
    02-18-2019
    Location
    United States
    MS-Off Ver
    Office 365
    Posts
    11

    Re: Need Help Coding ComboBoxes

    Hey Kev,

    Yes they are linked to the cells below them, and I was trying to activate a range because I have no clue what I am doing. However, I have managed to make this work by using the tab key with the following code throughout each combobox;

    Private Sub ComboBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If KeyCode = vbKeyTab Then
    NavOle Me.OLEObjects(Me.ComboBox1.Index), Shift
    End If

    End Sub

    Private Sub ComboBox2_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If KeyCode = vbKeyTab Then
    NavOle Me.OLEObjects(Me.ComboBox2.Index), Shift
    End If

    End Sub

    Private Sub ComboBox3_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If KeyCode = vbKeyTab Then
    NavOle Me.OLEObjects(Me.ComboBox3.Index), Shift
    End If

    End Sub

    Private Sub ComboBox4_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If KeyCode = vbKeyTab Then
    NavOle Me.OLEObjects(Me.ComboBox4.Index), Shift
    End If

    End Sub

    Private Sub ComboBox5_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If KeyCode = vbKeyTab Then
    NavOle Me.OLEObjects(Me.ComboBox5.Index), Shift
    End If

    End Sub

    Private Sub ComboBox6_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If KeyCode = vbKeyTab Then
    NavOle Me.OLEObjects(Me.ComboBox6.Index), Shift
    End If

    End Sub

    Private Sub ComboBox7_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If KeyCode = vbKeyTab Then
    NavOle Me.OLEObjects(Me.ComboBox7.Index), Shift
    End If

    End Sub

    Private Sub ComboBox8_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If KeyCode = vbKeyTab Then
    NavOle Me.OLEObjects(Me.ComboBox8.Index), Shift
    End If

    End Sub

    Private Sub ComboBox9_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If KeyCode = vbKeyTab Then
    NavOle Me.OLEObjects(Me.ComboBox9.Index), Shift
    End If

    End Sub

    Private Sub ComboBox10_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If KeyCode = vbKeyTab Then
    NavOle Me.OLEObjects(Me.ComboBox10.Index), Shift
    End If

    End Sub

    Private Sub ComboBox11_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If KeyCode = vbKeyTab Then
    NavOle Me.OLEObjects(Me.ComboBox11.Index), Shift
    End If

    End Sub

    Private Sub ComboBox12_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If KeyCode = vbKeyTab Then
    NavOle Me.OLEObjects(Me.ComboBox12.Index), Shift
    End If

    End Sub

    Private Sub ComboBox13_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If KeyCode = vbKeyTab Then
    NavOle Me.OLEObjects(Me.ComboBox13.Index), Shift
    End If

    End Sub

    Private Sub ComboBox14_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If KeyCode = vbKeyTab Then
    NavOle Me.OLEObjects(Me.ComboBox14.Index), Shift
    End If

    End Sub

    Private Sub ComboBox15_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If KeyCode = vbKeyTab Then
    NavOle Me.OLEObjects(Me.ComboBox15.Index), Shift
    End If

    End Sub

    Private Sub ComboBox16_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If KeyCode = vbKeyTab Then
    NavOle Me.OLEObjects(Me.ComboBox16.Index), Shift
    End If

    End Sub

    Private Sub ComboBox17_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If KeyCode = vbKeyTab Then
    NavOle Me.OLEObjects(Me.ComboBox17.Index), Shift
    End If

    End Sub

    Private Sub ComboBox18_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If KeyCode = vbKeyTab Then
    NavOle Me.OLEObjects(Me.ComboBox18.Index), Shift
    End If

    End Sub

    Private Sub ComboBox19_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If KeyCode = vbKeyTab Then
    NavOle Me.OLEObjects(Me.ComboBox19.Index), Shift
    End If

    End Sub

    Private Sub ComboBox20_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If KeyCode = vbKeyTab Then
    NavOle Me.OLEObjects(Me.ComboBox20.Index), Shift
    End If

    End Sub

    Private Sub ComboBox21_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If KeyCode = vbKeyTab Then
    NavOle Me.OLEObjects(Me.ComboBox21.Index), Shift
    End If

    End Sub

    Private Sub NavOle(ByRef OleActive As OLEObject, Shift As Integer)

    If Shift = 1 Then
    If OleActive.Index = 1 Then
    Me.OLEObjects(Me.OLEObjects.Count).Activate
    Else
    Me.OLEObjects(OleActive.Index - 1).Activate
    End If
    Else
    If OleActive.Index = Me.OLEObjects.Count Then
    Me.OLEObjects(1).Activate
    Else
    Me.OLEObjects(OleActive.Index + 1).Activate
    End If
    End If

    End Sub

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,410

    Re: Need Help Coding ComboBoxes

    Hi.
    Just an aged gents view.
    You would be better familiarising yourself with 'userforms' they make coding a whole lot easier.
    Also when used on the 'sheet' ActiveX also tends to be unpredictably if you intend placing the app on various other computers.
    torachan.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] In need of help regarding combo box coding and button coding (Access form project)
    By mailblade in forum Access Tables & Databases
    Replies: 2
    Last Post: 01-09-2016, 01:34 AM
  2. Coding comboboxes to limit to list
    By fenfool in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-12-2015, 11:33 AM
  3. Replies: 3
    Last Post: 02-18-2015, 02:02 PM
  4. Help! Entire Row Hidden - w/Two ComboBoxes - Doesn't Hide the ComboBoxes
    By ocnmel in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-06-2015, 09:27 AM
  5. filtering comboboxes depend on value of other comboboxes
    By hassan khansa in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-18-2014, 09:18 AM
  6. [SOLVED] Vb macro coding for transpose - complete coding?
    By Dharani Suresh in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-02-2013, 05:04 AM
  7. [SOLVED] Calculating Time in Userform Textbox and Filtering Comboboxes Coding Help
    By hiddenupnorth in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-01-2012, 01:12 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1