Excel User Form with Combo box

mmue

New Member
Joined
Jun 28, 2011
Messages
3
Hello everyone,

I try to create user form and one part i have is combobox wit customer IDs within it. What I want to do is ACTIVATE the correct sheet renamed into IDs, after I make a choice. e.g if i choose ID 10002 I wanna activate sheet 10002.

can you please help on this

thanks and regards
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
hi Mmue,

Try this
Code:
Private Sub ComboBox1_Change()
    Dim id As String
    id = ComboBox1.Value
    Sheets(id).Select
End Sub
 
Upvote 0
Maybe...

Code:
[font=Verdana][color=darkblue]Option[/color] [color=darkblue]Explicit[/color]

[color=darkblue]Private[/color] [color=darkblue]Sub[/color] ComboBox1_Change()
    [color=darkblue]Dim[/color] sh [color=darkblue]As[/color] [color=darkblue]Object[/color]
    [color=darkblue]With[/color] Me.ComboBox1
        [color=darkblue]If[/color] .Text <> "" [color=darkblue]Then[/color]
            [color=darkblue]On[/color] [color=darkblue]Error[/color] [color=darkblue]Resume[/color] [color=darkblue]Next[/color]
            [color=darkblue]Set[/color] sh = Sheets(.Text)
            [color=darkblue]If[/color] sh [color=darkblue]Is[/color] [color=darkblue]Nothing[/color] [color=darkblue]Then[/color]
                [color=darkblue]Exit[/color] [color=darkblue]Sub[/color]
            [color=darkblue]Else[/color]
                Sheets(.Text).Activate
            [color=darkblue]End[/color] [color=darkblue]If[/color]
        [color=darkblue]End[/color] [color=darkblue]If[/color]
    [color=darkblue]End[/color] [color=darkblue]With[/color]
[color=darkblue]End[/color] [color=darkblue]Sub[/color]
[/font]
 
Upvote 0

Forum statistics

Threads
1,224,502
Messages
6,179,126
Members
452,890
Latest member
Nikhil Ramesh

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