Find cell location based on value then do something- User Forms VBA Excel

前端 未结 1 1143
梦毁少年i
梦毁少年i 2021-01-28 01:19

i have experience in programing, however, I am new to VBA. I have a user form that i am working on. This form has a Combo Box that has a list initialized to it. What i am trying

相关标签:
1条回答
  • 2021-01-28 01:33

    Your code doesn't compile.

    If you have a userform with a single combobox called ComboBox1, you need to put your cell-finding code in the form code as follows:

    Private Sub ComboBox1_Change()
        MsgBox "yep, this is where the code should go"
    End Sub
    

    I suspect using the rowsource property of the combobox in combination with the index of the selected value you probably don't need to actually perform a search for the selected value. Something like this might work:

    Private Sub ComboBox1_Change()
        MsgBox Range(ComboBox1.RowSource).Cells(ComboBox1.ListIndex + 1)
    End Sub
    

    Hope that helps.

    0 讨论(0)
提交回复
热议问题