Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default need code for hiding/unhiding sheets using checkboxes

I am creating a workbook that contains multiple sheets. I want certain
sheets to be hidden once the workbook opens. Then I want the user to be able
to select the type of work via a checkbox. Once a checkbox is selected, I
want to be able to unhide the sheet that pertains to that type of work. Code
could either be off checkbox object or a cell that I used for Control Cell
link value (true/false). Any help would be greatly appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,836
Default need code for hiding/unhiding sheets using checkboxes

This is how I do it. Just right-click a sheet, name it password, and
copy/paste this code into the window that opens:
Private Sub CommandButton1_Click()


Dim i_pwd As String

i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
If i_pwd = "" Then
Exit Sub
End If
Select Case (i_pwd)

'#1
Case Is = "password1"
Worksheets("Sheet1").Visible = True
Worksheets("Sheet2").Visible = True
Worksheets("Sheet3").Visible = True


'#2
Case Is = "password2"
Worksheets("Sheet4").Visible = True
Worksheets("Sheet5").Visible = True
Worksheets("Sheet6").Visible = True


'#3
Case Is = "password3"
Worksheets("Sheet7").Visible = True
Worksheets("Sheet8").Visible = True
Worksheets("Sheet9").Visible = True


'#11
Case Is = "showall"
Call ShowSheets


Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, _
"Unhide Sheet..."
End Select

Exit Sub


End Sub

Follow the logic. You should changes the text in quotes to match the sheets
that you want displayed, when the user clicks the Command Button to fire the
code. one more thing, since this is event code, linked to a private sub,
make sure you use the button from the 'Control Toolbox'; choose the
appropriate toolbar menu.


Regards,
Ryan---

--
RyGuy


"pzx8hf" wrote:

I am creating a workbook that contains multiple sheets. I want certain
sheets to be hidden once the workbook opens. Then I want the user to be able
to select the type of work via a checkbox. Once a checkbox is selected, I
want to be able to unhide the sheet that pertains to that type of work. Code
could either be off checkbox object or a cell that I used for Control Cell
link value (true/false). Any help would be greatly appreciated.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
unhiding and hiding rows Paul_of_Abingdon[_2_] Excel Discussion (Misc queries) 2 March 6th 08 03:22 PM
Hiding/Unhiding Columns Karen McKenzie Excel Worksheet Functions 3 August 10th 06 11:49 AM
Hiding/Unhiding Columns xkarenxxxx Excel Worksheet Functions 8 June 5th 06 02:18 PM
Hiding and unhiding sheets D.Hay Excel Discussion (Misc queries) 2 December 10th 05 03:59 PM
Hiding/Unhiding Bobby Excel Worksheet Functions 2 May 25th 05 10:40 PM


All times are GMT +1. The time now is 07:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"