Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Hide or display worksheets based on form

Worksheet 1 displays a list of questions. Based on the answer of those
questions (via checkbox), I would like to display different worksheets. For
example the worksheet one is always displayed. If you select yes to question
#1, then worksheet 2 appears. If you select yes to question #2 then
worksheet 3 also appears. Can this be done?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Hide or display worksheets based on form


Yes of course it can be done, using code similar to below, it goes in
the sheet1 code module:

Code:
--------------------
Private Sub CheckBox1_Click()
Dim Sh As Worksheet
For Each Sh In Sheets
If Sh.Name = "Sheet1" Or Sh.Name = "Sheet2" Then
Else
Sh.Visible = xlSheetHidden
End If
End Sub
Private Sub CheckBox2_Click()
Dim Sh As Worksheet
For Each Sh In Sheets
If Sh.Name = "Sheet1" Or Sh.Name = "Sheet3" Then
Else
Sh.Visible = xlSheetHidden
End If
End Sub
Private Sub CheckBox3_Click()
Dim Sh As Worksheet
For Each Sh In Sheets
If Sh.Name = "Sheet1" Or Sh.Name = "Sheet4" Then
Else
Sh.Visible = xlSheetHidden
End If
End Sub
--------------------
Shawnn;164128 Wrote:
Worksheet 1 displays a list of questions. Based on the answer of those
questions (via checkbox), I would like to display different worksheets.
For
example the worksheet one is always displayed. If you select yes to
question
#1, then worksheet 2 appears. If you select yes to question #2 then
worksheet 3 also appears. Can this be done?



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=45581

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,346
Default Hide or display worksheets based on form

Hi,

Assuming you have a separate checkbox for each sheet the code for each would
look something like this

Private Sub CheckBox1_Click()
If CheckBox1 = True Then
Sheet2.Visible = xlSheetVisible
Else
Sheet2.Visible = xlSheetHidden
End If
End Sub

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Shawnn" wrote:

Worksheet 1 displays a list of questions. Based on the answer of those
questions (via checkbox), I would like to display different worksheets. For
example the worksheet one is always displayed. If you select yes to question
#1, then worksheet 2 appears. If you select yes to question #2 then
worksheet 3 also appears. Can this be done?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,346
Default Hide or display worksheets based on form

Hi again,

I realize I should add that in the notation

Sheet2.Visible = xlSheetVisible

Sheet2 is the code windows name for the sheet if you use the spreadsheet
name you must write the above line as

Sheets("Sheet2").Visible = xlSheetVisible

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Shawnn" wrote:

Worksheet 1 displays a list of questions. Based on the answer of those
questions (via checkbox), I would like to display different worksheets. For
example the worksheet one is always displayed. If you select yes to question
#1, then worksheet 2 appears. If you select yes to question #2 then
worksheet 3 also appears. Can this be done?

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
Is there a formula to hide/ display row based on cell value in Exc RickA Excel Worksheet Functions 2 September 14th 07 09:33 PM
how to hide a form button in a worksheet angie ng Excel Discussion (Misc queries) 1 May 21st 07 01:08 PM
Automate display/ hide rows in excel based on yes/no check box schraplau Excel Discussion (Misc queries) 0 April 25th 06 07:48 PM
Is there a way to hide worksheets and/or rows/columns based on information enter into a particular cell of range of cells? Marc New Users to Excel 1 March 10th 06 05:10 PM
have 3 worksheets, 1 is a form, the other 2 data for the form-wan. bken Excel Worksheet Functions 0 January 12th 05 09:15 PM


All times are GMT +1. The time now is 09:58 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"