hide and unhde worksheets when a set button on a form is clicked

D

Dave ferris

hi everyone,
i have a work book with 4 worksheets i have a userform that is initialised
when the workbook is opened. on the form is 4 buttons one for each sheet.
button one would show the worksheet tabs for sheets 1 and 2,
button two would show the worksheet tabs for sheets 1 and 3,
button three would show the worksheet tabs for sheet 1,
button four would show the worksheet tabs for sheets 1 and 4,

i'm taking it that by hiding the worksheet tabs that the worksheet itself is
hidden!

help in this dilema is very much appreciated.
thank you

Dave ferris
 
M

Mike Fogleman

In the UserForm code window put this code for the Option Buttons:

Private Sub OptionButton1_Click()
Sheet1.Visible = True
Sheet2.Visible = True
Sheet3.Visible = False
Sheet4.Visible = False
End Sub

Private Sub OptionButton2_Click()
Sheet1.Visible = True
Sheet2.Visible = False
Sheet3.Visible = True
Sheet4.Visible = False
End Sub

Private Sub OptionButton3_Click()
Sheet1.Visible = True
Sheet2.Visible = False
Sheet3.Visible = False
Sheet4.Visible = False
End Sub

Private Sub OptionButton4_Click()
Sheet1.Visible = True
Sheet2.Visible = False
Sheet3.Visible = False
Sheet4.Visible = True
End Sub

Mike F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top