Load sheet with drop down menu

Solved/Closed
Alexandra - Jun 20, 2010 at 01:12 AM
 Alexandra - Jun 20, 2010 at 09:28 AM
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 responses

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Jun 20, 2010 at 05:54 AM
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
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
0
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Jun 20, 2010 at 09:05 AM
BOL might be hidden. make it visible first
0
Thank you that was the problem :)
0