Each combobox selection jumps to a new row

jlwoods

New Member
Joined
Dec 19, 2014
Messages
2
Hi - I am incredibly new to using macros, so I am having difficult doing the following: I have a combobox with 20 different choices, all of which relate to a new row on a worksheet. I want to make it so when one of the 20 options is chosen, the spreadsheet jumps down to the row in which it corresponds to, to make it easier for people to navigate (instead of scrolling for ages). I can figure out to enter the dropdown values, but I cannot figure out how to have each selection jump to different rows, partially as I know little about VBA. Any help would be appreciated.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
This code should do the trick once names and references are applied to match your scenario.
You'll need to open up VB and doubleclick on the sheet you want the code to function on (i.e. Sheet1)

Paste the following code to that sheet, updating to fit your setup
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim targ As Range   'Watch Cell/range
Set targ = Intersect(Target, Range("B1"))   [COLOR=#008000]'change B1 to cell with dropdown[/COLOR]
If Not targ Is Nothing Then
[COLOR=#008000]'=====================================================
'   change the letters in the Case statement to match
'   options in dropdowns.  Change the value in the
'   [ ] to the range you want to jump to
'=====================================================[/COLOR]
    Select Case targ.Value
    Case "[COLOR=#FF0000]A[/COLOR]"    [COLOR=#008000]'Text of first item in list[/COLOR]
        [[COLOR=#FF0000]A5[/COLOR]].Select    [COLOR=#008000]'change to where to go[/COLOR]
    Case "[COLOR=#FF0000]B[/COLOR]"
        [[COLOR=#FF0000]A10[/COLOR]].Select
    Case "[COLOR=#FF0000]C[/COLOR]"
        [[COLOR=#FF0000]A15[/COLOR]].Select
    End Select
End If
End Sub

When it's complete, the file will need to be saved as a macro-enabled workbook (*.xlsm) in order to function.
 
Last edited:
Upvote 0
CalcSux78 this is exactly the answer I was looking for! Thank you.
I have used this with a data validation drop down list, but I would like to place several of these lists on to one sheet, but this causes a compile list as the code is ambiguous and needs defining. Can you recommend a way to do this?
 
Upvote 0

Forum statistics

Threads
1,215,772
Messages
6,126,806
Members
449,337
Latest member
BBV123

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