Results 1 to 2 of 2

Thread: Toggle Between RowSource Items And List Items In A ComboBox Based On Criteria

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    Mar 2018
    Posts
    12
    Rep Power
    0

    Lightbulb Toggle Between RowSource Items And List Items In A ComboBox Based On Criteria

    Hi All,
    I have a small problem. Attached a small spreadsheet.

    I have a form with two combo boxes. The row sources are “Languages” and “Levels”

    Some of the languages have a “*” on the right of the string.

    When I select a language, the second column is also populated.

    When I select languages with “*” at the right of the string, I want only "Lower" is the only level can be selected.

    Code:
    Private Sub CommandButton1_Click()
    Dim eRow As Long
        eRow = Sheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
        Sheets("Sheet2").Activate  
        Cells(eRow, 1) = ComboBox1.Text
        Cells(eRow, 2) = ComboBox1.Column(1)
        If Right(ComboBox2.Text, 1) = "*" Then
            ComboBox2.RowSource = Sheets("Sheet2").Range("E2")
        Else
            ComboBox2.RowSource = "Levels"
        End If
        Cells(eRow, 3) = ComboBox2.Text
        ComboBox1.Text = ""
        ComboBox2.Text = "”
    End Sub

    Any help with editing the code will be helpful.

    Thank you

    Raghavendra
    Attached Files Attached Files

Similar Threads

  1. Replies: 3
    Last Post: 10-11-2013, 02:52 PM
  2. Replies: 10
    Last Post: 08-29-2013, 08:20 PM
  3. Replies: 8
    Last Post: 08-17-2013, 04:03 AM
  4. Replies: 25
    Last Post: 08-02-2013, 07:23 AM
  5. Replies: 14
    Last Post: 06-27-2013, 10:57 AM

Posting Permissions

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