Jump to cell when choosing a value in a combo box

Jonasmj

New Member
Joined
Sep 23, 2002
Messages
38
I have created a combo box that has the choice of several different values.
I made a small list with those values located on the same sheet as the combo box. When I choose a value I want to be taken to the cell in a specified column where this value is presented for the first time. Ie a kind of search function based on what the user chooses in the combo box.

I know I can use
Cells.Find(What:="value" but I don't know how I find the argument "value" from the selected value in the combo box.
What code is used?

Regards Joans
 
jimboy said:
This is not tested fully, but see what you think of this, if it can't find your value in the list below it will select A1 and start again;

Code:
Dim counter As Integer
counter = 0
    ComboBox1.ListFillRange = "a1:a10"

Dim c As Range
mystart:
For Each c In Range("A" & ActiveCell.Row + 1 & ":A500")
    If c.Value = ComboBox1.Value Then
    c.Select
    If MsgBox("Is this the value you are looking for?", vbYesNo) = vbNo Then GoTo myexit
    Exit Sub
    End If
myexit:
    Next
    If counter >= 1 Then Exit Sub
    Range("A1").Select
    counter = counter + 1
    GoTo mystart

I solved it (I think)
Just removed "myexit" and msgbox and voila :)
Code:
Dim counter As Integer
counter = 0
    ComboBox1.ListFillRange = "a1:a10"

Dim c As Range
mystart:
For Each c In Range("A" & ActiveCell.Row + 1 & ":A500")
    If c.Value = ComboBox1.Value Then
    c.Select
    Exit Sub
    End If
    Next

Thank you jimboy!
 
Upvote 0

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,214,651
Messages
6,120,739
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top