#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35
Default Can you hide Sheets?

Can you make sheets invisible and if so, how can you recall them [make them
visible again]?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default Can you hide Sheets?


To hide a sheet, go to the Format menu, choose Worksheet, and then
select Hide. To make a hidden sheet visible, go to the Format menu,
choose Worksheet, and then select UnHide.

You can do this with code in a manner similar to the following:

' hide the sheets
ThisWorkbook.Worksheets("Sheet1").Visible = xlHidden
ThisWorkbook.Worksheets("Sheet2").Visible = xlVeryHidden

' unhide the sheets
ThisWorkbook.Worksheets("Sheet1").Visible = xlVisible
ThisWorkbook.Worksheets("Sheet2").Visible = xlVisible

' hide all but active sheet
Dim WS As Worksheet
For Each WS In ThisWorkbook.Worksheets
If StrComp(ActiveSheet.Name, WS.Name, vbBinaryCompare) < 0 Then
WS.Visible = xlSheetHidden
End If
Next WS

' unhide all sheets
For Each WS In ThisWorkbook.Worksheets
WS.Visible = xlSheetVisible
Next WS


When the Visible property is xlVisible, the sheet is visible. When the
Visible property is xlHidden, the sheet is hidden but can be made
visible from the Format menu. When the Visible property is
xlVeryHidden, the sheet is hidden and cannot be made visible from the
Format menu.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Sat, 29 Nov 2008 07:46:01 -0800, Abdul
wrote:

Can you make sheets invisible and if so, how can you recall them [make them
visible again]?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,346
Default Can you hide Sheets?

Hi,

One point - you can't hide all of the sheets in a workbook, one must be
visible. Although you can hide the workbook.

In 2007 the command is Home, Format, Hide & Unhide, Hide Sheet.

If this helps, please click the Yes button

Cheers,
Shane Devenshire

"Abdul" wrote:

Can you make sheets invisible and if so, how can you recall them [make them
visible again]?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 694
Default Can you hide Sheets?

Hi Chip
I installed the codes for Very Hidden and works fine but to unhide I get
an error " Unable to set the visible property of the worksheet class"
this error is in VB editor runing the macro with F5 in the worksheet I
only get a Popup window with the number 400 nothing else
Regards
John
There is no failure except in no longer trying.
Elbert Hubbard

"Chip Pearson" wrote in message
...

To hide a sheet, go to the Format menu, choose Worksheet, and then
select Hide. To make a hidden sheet visible, go to the Format menu,
choose Worksheet, and then select UnHide.

You can do this with code in a manner similar to the following:

' hide the sheets
ThisWorkbook.Worksheets("Sheet1").Visible = xlHidden
ThisWorkbook.Worksheets("Sheet2").Visible = xlVeryHidden

' unhide the sheets
ThisWorkbook.Worksheets("Sheet1").Visible = xlVisible
ThisWorkbook.Worksheets("Sheet2").Visible = xlVisible

' hide all but active sheet
Dim WS As Worksheet
For Each WS In ThisWorkbook.Worksheets
If StrComp(ActiveSheet.Name, WS.Name, vbBinaryCompare) < 0 Then
WS.Visible = xlSheetHidden
End If
Next WS

' unhide all sheets
For Each WS In ThisWorkbook.Worksheets
WS.Visible = xlSheetVisible
Next WS


When the Visible property is xlVisible, the sheet is visible. When the
Visible property is xlHidden, the sheet is hidden but can be made
visible from the Format menu. When the Visible property is
xlVeryHidden, the sheet is hidden and cannot be made visible from the
Format menu.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Sat, 29 Nov 2008 07:46:01 -0800, Abdul
wrote:

Can you make sheets invisible and if so, how can you recall them [make
them
visible again]?


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Can you hide Sheets?

Did you protect the workbook (not the worksheet)?

If so, then unprotect the workbook first.

If no, you may want to share the code you're using to show the worksheets.

John wrote:

Hi Chip
I installed the codes for Very Hidden and works fine but to unhide I get
an error " Unable to set the visible property of the worksheet class"
this error is in VB editor runing the macro with F5 in the worksheet I
only get a Popup window with the number 400 nothing else
Regards
John
There is no failure except in no longer trying.
Elbert Hubbard

"Chip Pearson" wrote in message
...

To hide a sheet, go to the Format menu, choose Worksheet, and then
select Hide. To make a hidden sheet visible, go to the Format menu,
choose Worksheet, and then select UnHide.

You can do this with code in a manner similar to the following:

' hide the sheets
ThisWorkbook.Worksheets("Sheet1").Visible = xlHidden
ThisWorkbook.Worksheets("Sheet2").Visible = xlVeryHidden

' unhide the sheets
ThisWorkbook.Worksheets("Sheet1").Visible = xlVisible
ThisWorkbook.Worksheets("Sheet2").Visible = xlVisible

' hide all but active sheet
Dim WS As Worksheet
For Each WS In ThisWorkbook.Worksheets
If StrComp(ActiveSheet.Name, WS.Name, vbBinaryCompare) < 0 Then
WS.Visible = xlSheetHidden
End If
Next WS

' unhide all sheets
For Each WS In ThisWorkbook.Worksheets
WS.Visible = xlSheetVisible
Next WS


When the Visible property is xlVisible, the sheet is visible. When the
Visible property is xlHidden, the sheet is hidden but can be made
visible from the Format menu. When the Visible property is
xlVeryHidden, the sheet is hidden and cannot be made visible from the
Format menu.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Sat, 29 Nov 2008 07:46:01 -0800, Abdul
wrote:

Can you make sheets invisible and if so, how can you recall them [make
them
visible again]?


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 694
Default Can you hide Sheets?

Hi Dave
Thank you for your reply
The workbook is not hiden and I used the same line as below to hide it
("Very hidden")The macro was places in sheet2 not workbook but also tried in
the module,
Here is the line code:
Sub Visible()
ThisWorkbook.Worksheets("Sheet3").Visible = xlVisible
End Sub
Regards
John

"Dave Peterson" wrote in message
...
Did you protect the workbook (not the worksheet)?

If so, then unprotect the workbook first.

If no, you may want to share the code you're using to show the worksheets.

John wrote:

Hi Chip
I installed the codes for Very Hidden and works fine but to unhide I get
an error " Unable to set the visible property of the worksheet class"
this error is in VB editor runing the macro with F5 in the worksheet I
only get a Popup window with the number 400 nothing else
Regards
John
There is no failure except in no longer trying.
Elbert Hubbard

"Chip Pearson" wrote in message
...

To hide a sheet, go to the Format menu, choose Worksheet, and then
select Hide. To make a hidden sheet visible, go to the Format menu,
choose Worksheet, and then select UnHide.

You can do this with code in a manner similar to the following:

' hide the sheets
ThisWorkbook.Worksheets("Sheet1").Visible = xlHidden
ThisWorkbook.Worksheets("Sheet2").Visible = xlVeryHidden

' unhide the sheets
ThisWorkbook.Worksheets("Sheet1").Visible = xlVisible
ThisWorkbook.Worksheets("Sheet2").Visible = xlVisible

' hide all but active sheet
Dim WS As Worksheet
For Each WS In ThisWorkbook.Worksheets
If StrComp(ActiveSheet.Name, WS.Name, vbBinaryCompare) < 0 Then
WS.Visible = xlSheetHidden
End If
Next WS

' unhide all sheets
For Each WS In ThisWorkbook.Worksheets
WS.Visible = xlSheetVisible
Next WS


When the Visible property is xlVisible, the sheet is visible. When the
Visible property is xlHidden, the sheet is hidden but can be made
visible from the Format menu. When the Visible property is
xlVeryHidden, the sheet is hidden and cannot be made visible from the
Format menu.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Sat, 29 Nov 2008 07:46:01 -0800, Abdul
wrote:

Can you make sheets invisible and if so, how can you recall them [make
them
visible again]?


--

Dave Peterson


  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Can you hide Sheets?

It's not the visibility of the workbook that's important. It's whether the
workbook is protected.

In xl2003 menus:
Tools|Protection
Do you see "Unprotect Workbook" as an option? If you do, then you have to
unprotect the workbook before you unhide a worksheet.

This code belongs in a general module--not behind a worksheet and not behind the
ThisWorkbook module.

And by using ThisWorkbook, that means that the workbook containing the code is
the workbook that should have Sheet3 made visible.

ps. I wouldn't name the subroutine visible, I'd use a different name. Visible
is the name of a property that VBA owns. It may not confuse excel, but it could
confuse me.

Sub MacVisible()
ThisWorkbook.Worksheets("Sheet3").Visible = xlVisible
'or maybe
'Activeworkbook.Worksheets("Sheet3").Visible = xlVisible
End Sub


John wrote:

Hi Dave
Thank you for your reply
The workbook is not hiden and I used the same line as below to hide it
("Very hidden")The macro was places in sheet2 not workbook but also tried in
the module,
Here is the line code:
Sub Visible()
ThisWorkbook.Worksheets("Sheet3").Visible = xlVisible
End Sub
Regards
John

"Dave Peterson" wrote in message
...
Did you protect the workbook (not the worksheet)?

If so, then unprotect the workbook first.

If no, you may want to share the code you're using to show the worksheets.

John wrote:

Hi Chip
I installed the codes for Very Hidden and works fine but to unhide I get
an error " Unable to set the visible property of the worksheet class"
this error is in VB editor runing the macro with F5 in the worksheet I
only get a Popup window with the number 400 nothing else
Regards
John
There is no failure except in no longer trying.
Elbert Hubbard

"Chip Pearson" wrote in message
...

To hide a sheet, go to the Format menu, choose Worksheet, and then
select Hide. To make a hidden sheet visible, go to the Format menu,
choose Worksheet, and then select UnHide.

You can do this with code in a manner similar to the following:

' hide the sheets
ThisWorkbook.Worksheets("Sheet1").Visible = xlHidden
ThisWorkbook.Worksheets("Sheet2").Visible = xlVeryHidden

' unhide the sheets
ThisWorkbook.Worksheets("Sheet1").Visible = xlVisible
ThisWorkbook.Worksheets("Sheet2").Visible = xlVisible

' hide all but active sheet
Dim WS As Worksheet
For Each WS In ThisWorkbook.Worksheets
If StrComp(ActiveSheet.Name, WS.Name, vbBinaryCompare) < 0 Then
WS.Visible = xlSheetHidden
End If
Next WS

' unhide all sheets
For Each WS In ThisWorkbook.Worksheets
WS.Visible = xlSheetVisible
Next WS


When the Visible property is xlVisible, the sheet is visible. When the
Visible property is xlHidden, the sheet is hidden but can be made
visible from the Format menu. When the Visible property is
xlVeryHidden, the sheet is hidden and cannot be made visible from the
Format menu.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Sat, 29 Nov 2008 07:46:01 -0800, Abdul
wrote:

Can you make sheets invisible and if so, how can you recall them [make
them
visible again]?


--

Dave Peterson


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 694
Default Can you hide Sheets?

Hi Dave
Thanks again for your patient.
I deleted the problem file and started with a new one.
I copied what you see below in a module.
It will hide ok but will not unhide, still getting the same error.
Regards
John
.................................................. .....
Sub testhide()
ThisWorkbook.Worksheets("Sheet2").Visible = xlVeryHidden

End Sub
.................................................. ...
Sub testunhide()

'ThisWorkbook.Worksheets("Sheet2").Visible = xlVisible
'or maybe
ActiveWorkbook.Worksheets("Sheet2").Visible = xlVisible
End Sub
.................................................. ....

"Dave Peterson" wrote in message
...
It's not the visibility of the workbook that's important. It's whether
the
workbook is protected.

In xl2003 menus:
Tools|Protection
Do you see "Unprotect Workbook" as an option? If you do, then you have to
unprotect the workbook before you unhide a worksheet.

This code belongs in a general module--not behind a worksheet and not
behind the
ThisWorkbook module.

And by using ThisWorkbook, that means that the workbook containing the
code is
the workbook that should have Sheet3 made visible.

ps. I wouldn't name the subroutine visible, I'd use a different name.
Visible
is the name of a property that VBA owns. It may not confuse excel, but it
could
confuse me.

Sub MacVisible()
ThisWorkbook.Worksheets("Sheet3").Visible = xlVisible
'or maybe
'Activeworkbook.Worksheets("Sheet3").Visible = xlVisible
End Sub


John wrote:

Hi Dave
Thank you for your reply
The workbook is not hiden and I used the same line as below to hide it
("Very hidden")The macro was places in sheet2 not workbook but also tried
in
the module,
Here is the line code:
Sub Visible()
ThisWorkbook.Worksheets("Sheet3").Visible = xlVisible
End Sub
Regards
John

"Dave Peterson" wrote in message
...
Did you protect the workbook (not the worksheet)?

If so, then unprotect the workbook first.

If no, you may want to share the code you're using to show the
worksheets.

John wrote:

Hi Chip
I installed the codes for Very Hidden and works fine but to unhide I
get
an error " Unable to set the visible property of the worksheet class"
this error is in VB editor runing the macro with F5 in the worksheet I
only get a Popup window with the number 400 nothing else
Regards
John
There is no failure except in no longer trying.
Elbert Hubbard

"Chip Pearson" wrote in message
...

To hide a sheet, go to the Format menu, choose Worksheet, and then
select Hide. To make a hidden sheet visible, go to the Format menu,
choose Worksheet, and then select UnHide.

You can do this with code in a manner similar to the following:

' hide the sheets
ThisWorkbook.Worksheets("Sheet1").Visible = xlHidden
ThisWorkbook.Worksheets("Sheet2").Visible = xlVeryHidden

' unhide the sheets
ThisWorkbook.Worksheets("Sheet1").Visible = xlVisible
ThisWorkbook.Worksheets("Sheet2").Visible = xlVisible

' hide all but active sheet
Dim WS As Worksheet
For Each WS In ThisWorkbook.Worksheets
If StrComp(ActiveSheet.Name, WS.Name, vbBinaryCompare) < 0 Then
WS.Visible = xlSheetHidden
End If
Next WS

' unhide all sheets
For Each WS In ThisWorkbook.Worksheets
WS.Visible = xlSheetVisible
Next WS


When the Visible property is xlVisible, the sheet is visible. When
the
Visible property is xlHidden, the sheet is hidden but can be made
visible from the Format menu. When the Visible property is
xlVeryHidden, the sheet is hidden and cannot be made visible from
the
Format menu.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Sat, 29 Nov 2008 07:46:01 -0800, Abdul
wrote:

Can you make sheets invisible and if so, how can you recall them
[make
them
visible again]?

--

Dave Peterson


--

Dave Peterson


  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 694
Default Can you hide Sheets?

Me again
I should of said also that I tried both lines to unhide without success.
john
"John" wrote in message
...
Hi Dave
Thanks again for your patient.
I deleted the problem file and started with a new one.
I copied what you see below in a module.
It will hide ok but will not unhide, still getting the same error.
Regards
John
.................................................. ....
Sub testhide()
ThisWorkbook.Worksheets("Sheet2").Visible = xlVeryHidden

End Sub
.................................................. ..
Sub testunhide()

'ThisWorkbook.Worksheets("Sheet2").Visible = xlVisible
'or maybe
ActiveWorkbook.Worksheets("Sheet2").Visible = xlVisible
End Sub
.................................................. ...

"Dave Peterson" wrote in message
...
It's not the visibility of the workbook that's important. It's whether
the
workbook is protected.

In xl2003 menus:
Tools|Protection
Do you see "Unprotect Workbook" as an option? If you do, then you have
to
unprotect the workbook before you unhide a worksheet.

This code belongs in a general module--not behind a worksheet and not
behind the
ThisWorkbook module.

And by using ThisWorkbook, that means that the workbook containing the
code is
the workbook that should have Sheet3 made visible.

ps. I wouldn't name the subroutine visible, I'd use a different name.
Visible
is the name of a property that VBA owns. It may not confuse excel, but
it could
confuse me.

Sub MacVisible()
ThisWorkbook.Worksheets("Sheet3").Visible = xlVisible
'or maybe
'Activeworkbook.Worksheets("Sheet3").Visible = xlVisible
End Sub


John wrote:

Hi Dave
Thank you for your reply
The workbook is not hiden and I used the same line as below to hide it
("Very hidden")The macro was places in sheet2 not workbook but also
tried in
the module,
Here is the line code:
Sub Visible()
ThisWorkbook.Worksheets("Sheet3").Visible = xlVisible
End Sub
Regards
John

"Dave Peterson" wrote in message
...
Did you protect the workbook (not the worksheet)?

If so, then unprotect the workbook first.

If no, you may want to share the code you're using to show the
worksheets.

John wrote:

Hi Chip
I installed the codes for Very Hidden and works fine but to unhide I
get
an error " Unable to set the visible property of the worksheet class"
this error is in VB editor runing the macro with F5 in the worksheet
I
only get a Popup window with the number 400 nothing else
Regards
John
There is no failure except in no longer trying.
Elbert Hubbard

"Chip Pearson" wrote in message
...

To hide a sheet, go to the Format menu, choose Worksheet, and then
select Hide. To make a hidden sheet visible, go to the Format menu,
choose Worksheet, and then select UnHide.

You can do this with code in a manner similar to the following:

' hide the sheets
ThisWorkbook.Worksheets("Sheet1").Visible = xlHidden
ThisWorkbook.Worksheets("Sheet2").Visible = xlVeryHidden

' unhide the sheets
ThisWorkbook.Worksheets("Sheet1").Visible = xlVisible
ThisWorkbook.Worksheets("Sheet2").Visible = xlVisible

' hide all but active sheet
Dim WS As Worksheet
For Each WS In ThisWorkbook.Worksheets
If StrComp(ActiveSheet.Name, WS.Name, vbBinaryCompare) < 0 Then
WS.Visible = xlSheetHidden
End If
Next WS

' unhide all sheets
For Each WS In ThisWorkbook.Worksheets
WS.Visible = xlSheetVisible
Next WS


When the Visible property is xlVisible, the sheet is visible. When
the
Visible property is xlHidden, the sheet is hidden but can be made
visible from the Format menu. When the Visible property is
xlVeryHidden, the sheet is hidden and cannot be made visible from
the
Format menu.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Sat, 29 Nov 2008 07:46:01 -0800, Abdul
wrote:

Can you make sheets invisible and if so, how can you recall them
[make
them
visible again]?

--

Dave Peterson


--

Dave Peterson



  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Can you hide Sheets?

Sorry, there was a typo in the original that I didn't notice.

Instead of using xlvisible, use: xlSheetVisible


ActiveWorkbook.Worksheets("Sheet2").Visible = xlSheetVisible

Remember, ActiveWorkbook refers to the workbook that's currently active.
ThisWorkbook refers to the workbook that owns the code. They don't have to be
the same workbook.


John wrote:

Me again
I should of said also that I tried both lines to unhide without success.
john
"John" wrote in message
...
Hi Dave
Thanks again for your patient.
I deleted the problem file and started with a new one.
I copied what you see below in a module.
It will hide ok but will not unhide, still getting the same error.
Regards
John
.................................................. ....
Sub testhide()
ThisWorkbook.Worksheets("Sheet2").Visible = xlVeryHidden

End Sub
.................................................. ..
Sub testunhide()

'ThisWorkbook.Worksheets("Sheet2").Visible = xlVisible
'or maybe
ActiveWorkbook.Worksheets("Sheet2").Visible = xlVisible
End Sub
.................................................. ...

"Dave Peterson" wrote in message
...
It's not the visibility of the workbook that's important. It's whether
the
workbook is protected.

In xl2003 menus:
Tools|Protection
Do you see "Unprotect Workbook" as an option? If you do, then you have
to
unprotect the workbook before you unhide a worksheet.

This code belongs in a general module--not behind a worksheet and not
behind the
ThisWorkbook module.

And by using ThisWorkbook, that means that the workbook containing the
code is
the workbook that should have Sheet3 made visible.

ps. I wouldn't name the subroutine visible, I'd use a different name.
Visible
is the name of a property that VBA owns. It may not confuse excel, but
it could
confuse me.

Sub MacVisible()
ThisWorkbook.Worksheets("Sheet3").Visible = xlVisible
'or maybe
'Activeworkbook.Worksheets("Sheet3").Visible = xlVisible
End Sub


John wrote:

Hi Dave
Thank you for your reply
The workbook is not hiden and I used the same line as below to hide it
("Very hidden")The macro was places in sheet2 not workbook but also
tried in
the module,
Here is the line code:
Sub Visible()
ThisWorkbook.Worksheets("Sheet3").Visible = xlVisible
End Sub
Regards
John

"Dave Peterson" wrote in message
...
Did you protect the workbook (not the worksheet)?

If so, then unprotect the workbook first.

If no, you may want to share the code you're using to show the
worksheets.

John wrote:

Hi Chip
I installed the codes for Very Hidden and works fine but to unhide I
get
an error " Unable to set the visible property of the worksheet class"
this error is in VB editor runing the macro with F5 in the worksheet
I
only get a Popup window with the number 400 nothing else
Regards
John
There is no failure except in no longer trying.
Elbert Hubbard

"Chip Pearson" wrote in message
...

To hide a sheet, go to the Format menu, choose Worksheet, and then
select Hide. To make a hidden sheet visible, go to the Format menu,
choose Worksheet, and then select UnHide.

You can do this with code in a manner similar to the following:

' hide the sheets
ThisWorkbook.Worksheets("Sheet1").Visible = xlHidden
ThisWorkbook.Worksheets("Sheet2").Visible = xlVeryHidden

' unhide the sheets
ThisWorkbook.Worksheets("Sheet1").Visible = xlVisible
ThisWorkbook.Worksheets("Sheet2").Visible = xlVisible

' hide all but active sheet
Dim WS As Worksheet
For Each WS In ThisWorkbook.Worksheets
If StrComp(ActiveSheet.Name, WS.Name, vbBinaryCompare) < 0 Then
WS.Visible = xlSheetHidden
End If
Next WS

' unhide all sheets
For Each WS In ThisWorkbook.Worksheets
WS.Visible = xlSheetVisible
Next WS


When the Visible property is xlVisible, the sheet is visible. When
the
Visible property is xlHidden, the sheet is hidden but can be made
visible from the Format menu. When the Visible property is
xlVeryHidden, the sheet is hidden and cannot be made visible from
the
Format menu.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Sat, 29 Nov 2008 07:46:01 -0800, Abdul
wrote:

Can you make sheets invisible and if so, how can you recall them
[make
them
visible again]?

--

Dave Peterson

--

Dave Peterson



--

Dave Peterson


  #11   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 694
Default Can you hide Sheets?

Thank you Dave
It works great.
Regards
John
"Dave Peterson" wrote in message
...
Sorry, there was a typo in the original that I didn't notice.

Instead of using xlvisible, use: xlSheetVisible


ActiveWorkbook.Worksheets("Sheet2").Visible = xlSheetVisible

Remember, ActiveWorkbook refers to the workbook that's currently active.
ThisWorkbook refers to the workbook that owns the code. They don't have
to be
the same workbook.


John wrote:

Me again
I should of said also that I tried both lines to unhide without success.
john
"John" wrote in message
...
Hi Dave
Thanks again for your patient.
I deleted the problem file and started with a new one.
I copied what you see below in a module.
It will hide ok but will not unhide, still getting the same error.
Regards
John
.................................................. ....
Sub testhide()
ThisWorkbook.Worksheets("Sheet2").Visible = xlVeryHidden

End Sub
.................................................. ..
Sub testunhide()

'ThisWorkbook.Worksheets("Sheet2").Visible = xlVisible
'or maybe
ActiveWorkbook.Worksheets("Sheet2").Visible = xlVisible
End Sub
.................................................. ...

"Dave Peterson" wrote in message
...
It's not the visibility of the workbook that's important. It's
whether
the
workbook is protected.

In xl2003 menus:
Tools|Protection
Do you see "Unprotect Workbook" as an option? If you do, then you
have
to
unprotect the workbook before you unhide a worksheet.

This code belongs in a general module--not behind a worksheet and not
behind the
ThisWorkbook module.

And by using ThisWorkbook, that means that the workbook containing the
code is
the workbook that should have Sheet3 made visible.

ps. I wouldn't name the subroutine visible, I'd use a different name.
Visible
is the name of a property that VBA owns. It may not confuse excel,
but
it could
confuse me.

Sub MacVisible()
ThisWorkbook.Worksheets("Sheet3").Visible = xlVisible
'or maybe
'Activeworkbook.Worksheets("Sheet3").Visible = xlVisible
End Sub


John wrote:

Hi Dave
Thank you for your reply
The workbook is not hiden and I used the same line as below to hide
it
("Very hidden")The macro was places in sheet2 not workbook but also
tried in
the module,
Here is the line code:
Sub Visible()
ThisWorkbook.Worksheets("Sheet3").Visible = xlVisible
End Sub
Regards
John

"Dave Peterson" wrote in message
...
Did you protect the workbook (not the worksheet)?

If so, then unprotect the workbook first.

If no, you may want to share the code you're using to show the
worksheets.

John wrote:

Hi Chip
I installed the codes for Very Hidden and works fine but to unhide
I
get
an error " Unable to set the visible property of the worksheet
class"
this error is in VB editor runing the macro with F5 in the
worksheet
I
only get a Popup window with the number 400 nothing else
Regards
John
There is no failure except in no longer trying.
Elbert Hubbard

"Chip Pearson" wrote in message
...

To hide a sheet, go to the Format menu, choose Worksheet, and
then
select Hide. To make a hidden sheet visible, go to the Format
menu,
choose Worksheet, and then select UnHide.

You can do this with code in a manner similar to the following:

' hide the sheets
ThisWorkbook.Worksheets("Sheet1").Visible = xlHidden
ThisWorkbook.Worksheets("Sheet2").Visible = xlVeryHidden

' unhide the sheets
ThisWorkbook.Worksheets("Sheet1").Visible = xlVisible
ThisWorkbook.Worksheets("Sheet2").Visible = xlVisible

' hide all but active sheet
Dim WS As Worksheet
For Each WS In ThisWorkbook.Worksheets
If StrComp(ActiveSheet.Name, WS.Name, vbBinaryCompare) < 0
Then
WS.Visible = xlSheetHidden
End If
Next WS

' unhide all sheets
For Each WS In ThisWorkbook.Worksheets
WS.Visible = xlSheetVisible
Next WS


When the Visible property is xlVisible, the sheet is visible.
When
the
Visible property is xlHidden, the sheet is hidden but can be
made
visible from the Format menu. When the Visible property is
xlVeryHidden, the sheet is hidden and cannot be made visible
from
the
Format menu.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Sat, 29 Nov 2008 07:46:01 -0800, Abdul
wrote:

Can you make sheets invisible and if so, how can you recall them
[make
them
visible again]?

--

Dave Peterson

--

Dave Peterson


--

Dave Peterson


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
Code to hide sheets Tia[_3_] Excel Worksheet Functions 0 July 8th 08 11:07 AM
Hide sheets Tia[_3_] Excel Worksheet Functions 3 July 7th 08 08:13 PM
Hide sheets based on Cell value Mike Milmoe Excel Discussion (Misc queries) 4 January 16th 07 05:57 AM
hide sheets use data j2thea Excel Worksheet Functions 3 November 3rd 05 09:23 PM
macro to hide sheets ditchy Excel Discussion (Misc queries) 8 May 2nd 05 02:21 AM


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