Load sheet with drop down menu

Solved/Closed
Report
-
 Alexandra -
Hello

I have the userform1, and a combo box linked to two cells callled "UNIVERSAL BOL" AND "BLANK BOL", plus two sheets called "BOL" and "BLANK BOL", I'm looking for a code that every time the user press UNIVERSAL BOL on the drop down menu,it calls the sheet BOL AND WITH BLANK BOL calls the BLANK BOL sheet.

Can someone help me, Thank you very much



3 replies

Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
on change of combo box needs to be defined

there you would do some thing like this

Private Sub ComboBox1_Change()

    If ComboBox1.Value = "UNIVERSAL BOL" Then
        
        Sheets("BOL").Select
        UserForm1.Hide

    ElseIf ComboBox1.Value = "BLANK BOL" Then
    
        Sheets("BLANK BOL").Select
        UserForm1.Hide
    End If
    
End Sub
1
Thank you

A few words of thanks would be greatly appreciated. Add comment

CCM 2821 users have said thank you to us this month

Hi,

This is the code I'm using:

Private Sub ComboBox1_Change()

If ComboBox1.Value = "UNIVERSAL BOL" Then

Sheets("BOL").Select
UserForm6.Hide

ElseIf ComboBox1.Value = "BLANK BOL" Then

Sheets("BLANK").Select
UserForm6.Hide
End If

Sheets15.Visible = xlSheetVisible
Sheets16.Visible = xlSheetVisible
End Sub

Private Sub CommandButton1_Click()
Sheet2.Visible = xlSheetVisible
Sheet15.Visible = xlSheetVeryHidden
Sheet16.Visible = xlSheetVeryHidden
Sheet3.Visible = xlSheetVeryHidden
UserForm6.Hide
End Sub

Private Sub CommandButton2_Click()
Sheet3.Visible = xlSheetVisible
Sheet15.Visible = xlSheetVeryHidden
Sheet16.Visible = xlSheetVeryHidden
Sheet2.Visible = xlSheetVeryHidden
UserForm6.Hide
End Sub

-----------------

Sheet15 is BOL, Sheet 16 is "BLANK". I have two more buttons in my form, with its own code, Private Sub CommandButton1_Click() and Private Sub CommandButton2_Click().

But I'm having problems with Private Sub ComboBox1_Change() its highlighting "Sheets("BOL").Select" in my my Private Sub ComboBox1_Change(), do you know why??

Thank you
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
BOL might be hidden. make it visible first
Thank you that was the problem :)