0
votes

I have a userform with a combobox. The combobox selections come from a defined name list. I am trying to figure out how to have the code search for the combobox selection in a range of cells on the active sheet and select the cell to the right of the combobox selection in that range. I am fairly new to VBA and learning as I do it. Esentially, if "Car" is chosen in the combobox, find "car" in a range of the active sheet and select the cell to its right. Thanks in advance for any assistance you maybe able to provide.

1
Like: ActiveSheet.Cells.Find(combobox.value).Offset(,1).SelectJNevill
Thank you. It seems like that would work but I am getting Object variable or with block variable not set error. I am sure this is my lack of knowledge. I will see if I can figure out my problem. I appreciate it!Nick Galyon

1 Answers

0
votes

This should work:

ActiveSheet.Cells.Find(UserForm1.ComboBox1.Value).Offset(0, 1).Select

Use your UserForm name in place of UserForm1, same goes for CombBox1. Keep in mind that it will fail if you do not have combobox value (the one you are looking for) on the sheet.

Also include vbModeless next to your UserForm1.Show to allow cell selection.