Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
HL HL is offline
external usenet poster
 
Posts: 8
Default Hiding worksheets based on user selection

Hello,

I have created an Excell spreadsheet with 5 sheets. The tabs are called:
Introduction (sheet 1), Process A(sheet 2), Process B(sheet3), Process
C(sheet 4), & Process D (sheet 5).

For the Introduction sheet, I have four questions that can be answered Yes
or No. By the way, I am using a drop-down menu for the Yes/No response.

How can I hide specific sheets if the user answers yes to a question? For
example: If the user answer yes to the first question, then I would like to
hide sheets 3-5?

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JNW JNW is offline
external usenet poster
 
Posts: 480
Default Hiding worksheets based on user selection

This requires programming. No formula can do this.

It is not too difficult.

-Press Alt+F11 to open the VBA window
-If you don't see a file tree on the left press Ctrl+R
-Double click on the sheet where your drop down menus are
-Place the copy and paste the following code into the window:

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("B2").value = "Yes" then
Sheets("Process B").visible = false
Sheets("Process C").visible = false
Sheets("Process D").visible = false
ElseIf Range("B2").value = "No" then
Sheets("Process B").visible = true
Sheets("Process C").visible = true
Sheets("Process D").visible = true
End if
End Sub


Note that I've assumed that your drop down for the first question is in cell
B2. You can change that easy enough. I've also assumed that you've named
your sheets Process B, etc. If you need to change them make sure you keep
the name inside quotation marks.

Without more information it's hard to get this perfect for your needs, but
hopefully it gets you started.
--
JNW


"HL" wrote:

Hello,

I have created an Excell spreadsheet with 5 sheets. The tabs are called:
Introduction (sheet 1), Process A(sheet 2), Process B(sheet3), Process
C(sheet 4), & Process D (sheet 5).

For the Introduction sheet, I have four questions that can be answered Yes
or No. By the way, I am using a drop-down menu for the Yes/No response.

How can I hide specific sheets if the user answers yes to a question? For
example: If the user answer yes to the first question, then I would like to
hide sheets 3-5?

Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
HL HL is offline
external usenet poster
 
Posts: 8
Default Hiding worksheets based on user selection

JW, Thanks for the code. I was able to get it to work. I do have another
questinon. If the user changes his/her answer (example, answer was yes, now
the cell is blank) how do you get the worksheets to be visible again.

"JNW" wrote:

This requires programming. No formula can do this.

It is not too difficult.

-Press Alt+F11 to open the VBA window
-If you don't see a file tree on the left press Ctrl+R
-Double click on the sheet where your drop down menus are
-Place the copy and paste the following code into the window:

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("B2").value = "Yes" then
Sheets("Process B").visible = false
Sheets("Process C").visible = false
Sheets("Process D").visible = false
ElseIf Range("B2").value = "No" then
Sheets("Process B").visible = true
Sheets("Process C").visible = true
Sheets("Process D").visible = true
End if
End Sub


Note that I've assumed that your drop down for the first question is in cell
B2. You can change that easy enough. I've also assumed that you've named
your sheets Process B, etc. If you need to change them make sure you keep
the name inside quotation marks.

Without more information it's hard to get this perfect for your needs, but
hopefully it gets you started.
--
JNW


"HL" wrote:

Hello,

I have created an Excell spreadsheet with 5 sheets. The tabs are called:
Introduction (sheet 1), Process A(sheet 2), Process B(sheet3), Process
C(sheet 4), & Process D (sheet 5).

For the Introduction sheet, I have four questions that can be answered Yes
or No. By the way, I am using a drop-down menu for the Yes/No response.

How can I hide specific sheets if the user answers yes to a question? For
example: If the user answer yes to the first question, then I would like to
hide sheets 3-5?

Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JNW JNW is offline
external usenet poster
 
Posts: 480
Default Hiding worksheets based on user selection

Replace this line:
ElseIf Range("B2").value = "No" then

With:
Else:

That will say that if B2 is changed to anything other other than "yes" it
will make the sheets available again.
--
JNW


"HL" wrote:

JW, Thanks for the code. I was able to get it to work. I do have another
questinon. If the user changes his/her answer (example, answer was yes, now
the cell is blank) how do you get the worksheets to be visible again.

"JNW" wrote:

This requires programming. No formula can do this.

It is not too difficult.

-Press Alt+F11 to open the VBA window
-If you don't see a file tree on the left press Ctrl+R
-Double click on the sheet where your drop down menus are
-Place the copy and paste the following code into the window:

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("B2").value = "Yes" then
Sheets("Process B").visible = false
Sheets("Process C").visible = false
Sheets("Process D").visible = false
ElseIf Range("B2").value = "No" then
Sheets("Process B").visible = true
Sheets("Process C").visible = true
Sheets("Process D").visible = true
End if
End Sub


Note that I've assumed that your drop down for the first question is in cell
B2. You can change that easy enough. I've also assumed that you've named
your sheets Process B, etc. If you need to change them make sure you keep
the name inside quotation marks.

Without more information it's hard to get this perfect for your needs, but
hopefully it gets you started.
--
JNW


"HL" wrote:

Hello,

I have created an Excell spreadsheet with 5 sheets. The tabs are called:
Introduction (sheet 1), Process A(sheet 2), Process B(sheet3), Process
C(sheet 4), & Process D (sheet 5).

For the Introduction sheet, I have four questions that can be answered Yes
or No. By the way, I am using a drop-down menu for the Yes/No response.

How can I hide specific sheets if the user answers yes to a question? For
example: If the user answer yes to the first question, then I would like to
hide sheets 3-5?

Thanks.

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
macro that brings user to cell based on "yes/no" response lennyx2 Excel Discussion (Misc queries) 2 February 9th 05 02:47 PM
Hiding columns based on user/password jmatchus Excel Worksheet Functions 0 January 17th 05 06:49 PM
Hiding Worksheets Jo Davis Setting up and Configuration of Excel 4 January 13th 05 11:15 PM
limit cell list selection based on the selection of another list lorraine Excel Worksheet Functions 2 December 14th 04 08:17 PM
Hiding rows based on date Steve Excel Worksheet Functions 2 November 1st 04 02:30 PM


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