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

牧云@^-^@ 提交于 2019-12-02 11:40:11

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!