ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hide Sheet when another sheet is chosen (https://www.excelbanter.com/excel-programming/399026-hide-sheet-when-another-sheet-chosen.html)

AJ

Hide Sheet when another sheet is chosen
 
Hello
I have a workbook with just two work sheets.
Sheet 1 is the one with details and is hidden unless I need to update it.
Sheet 2 is the one being used most of the time.

What I would like to do is to write a code that after I update the data in
Sheet 1 and when I select Sheet 2 to use it, Sheet 1 must be hidden (and
remain hidden) until the time I unhide using the normal Unhide command in the
Format Menu.

Thanks in advance for your help.

Roger Whitehead[_2_]

Hide Sheet when another sheet is chosen
 
In the VBA Module for Sheet1, enter

Sheets("Sheet1").Visible = False

in the Worksheet_Deactivate event.

Your finished code will look like:

Private Sub Worksheet_Deactivate()
Sheets("Sheet1").Visible = False
End Sub

---
HTH
Roger
Shaftesbury (UK)
(Excel 2003, Win XP/SP2)



"AJ" wrote in message
...
Hello
I have a workbook with just two work sheets.
Sheet 1 is the one with details and is hidden unless I need to update it.
Sheet 2 is the one being used most of the time.

What I would like to do is to write a code that after I update the data in
Sheet 1 and when I select Sheet 2 to use it, Sheet 1 must be hidden (and
remain hidden) until the time I unhide using the normal Unhide command in
the
Format Menu.

Thanks in advance for your help.




Steven van Hell

Hide Sheet when another sheet is chosen
 
On 10 okt, 08:30, AJ wrote:
Hello
I have a workbook with just two work sheets.
Sheet 1 is the one with details and is hidden unless I need to update it.
Sheet 2 is the one being used most of the time.

What I would like to do is to write a code that after I update the data in
Sheet 1 and when I select Sheet 2 to use it, Sheet 1 must be hidden (and
remain hidden) until the time I unhide using the normal Unhide command in the
Format Menu.

Thanks in advance for your help.


The most simple way to do this is with a macro in Sheet1
and then use the code:

Private Sub Worksheet_Deactivate()
Worksheets(1).Visible = xlSheetHidden
End Sub

greetings

Steven



All times are GMT +1. The time now is 03:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com