Solved I want to use the values selected in combobox to go to cell

November 5, 2012 at 03:11:46
Specs: Windows 7
I have combobox (active control) with list range, if I select a value from that list, I want to go to a cell in a column with that exact value. (Match the value selected from combobox)
This code works, but only with the value "costs". I want to replace the static value "costs" which I put in, with a selection from the combobox.

Private Sub combobox1_Change()

Cells.Find(what:="Cost", After:=ActiveCell, LookIn _
:=xlValues, Lookat:=xlWhole, Searchorder:=xlByRows, Searchdirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate

End Sub

Thanks


See More: I want to use the values selected in combobox to go to cell

Report •

#1
November 5, 2012 at 03:31:30
✔ Best Answer
The reason "Cost" is only being picked up is because you have What:="Cost"

What i would do is replace the "Cost" with a variable which picks up the value from your combobox

Like this

Dim FindVal
FindVal = Combobox1.Value


Cells.Find(what:=FindVal, After:=ActiveCell, LookIn _
:=xlValues, Lookat:=xlWhole, Searchorder:=xlByRows, Searchdirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate

Now when you change the combox value it will search for that value in your worksheet.


Report •

#2
November 5, 2012 at 04:19:45
Thanks a lot

Report •
Related Solutions


Ask Question