How to show and hide a worksheet when we select an element of combined combo (list activex) ?

francois.lemarie

Board Regular
Joined
Mar 24, 2010
Messages
54
Hello,

I am working with the following file :
http://depositfiles.com/es/files/qx3unewrn

I have a combolist (ListBox but not in a form, in Activex) with various choices. I want a worksheet to be shown only if I choose "Closed - won". It must be hidden otherwise.

I trew a code but the worksheet is hidden all the time.

What's wrong ? Anyone could be so kind to give me the good code ?

Private Sub ComboStatusopp_Change()
If ComboStatusopp.Value = Closed - won Then
Worksheets("CloseInfo").Visible = True
Else
Worksheets("CloseInfo").Visible = False
End If

End Sub

Thanks a lot
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

MickG

MrExcel MVP
Joined
Jan 9, 2008
Messages
14,841
Hi, Try:-
Code:
Private [COLOR="Navy"]Sub[/COLOR] ComboStatusopp_Change()
[COLOR="Navy"]If[/COLOR] ComboStatusopp.Value = "Closed - won" [COLOR="Navy"]Then[/COLOR]
    Sheets("CloseInfo").Visible = True
[COLOR="Navy"]Else[/COLOR]
    Sheets("CloseInfo").Visible = False
[COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 

Forum statistics

Threads
1,136,333
Messages
5,675,175
Members
419,552
Latest member
jsanjur

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
Top