Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Hide/Unhide worksheets help

Using OfficeXP.
In a fresh workbook from the immediate window...

This works.
Worksheets(Array("Sheet1", "Sheet2")).Visible = xlSheetHidden

This:
Worksheets(Array("Sheet1", "Sheet2")).Visible = xlSheetVisible

gives the following error

Run-time error '1004':
Unable to set the Visible property of the Sheets class

This seems like an easy one, but I haven't been able to find an answer.

Thanks,
-Jeremy


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Hide/Unhide worksheets help

You can use this Jeremy

Dim sh As Worksheet
For Each sh In Sheets(Array("Sheet1", "Sheet2"))
sh.Visible = True
Next


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Jeremy Gollehon" wrote in message ...
Using OfficeXP.
In a fresh workbook from the immediate window...

This works.
Worksheets(Array("Sheet1", "Sheet2")).Visible = xlSheetHidden

This:
Worksheets(Array("Sheet1", "Sheet2")).Visible = xlSheetVisible

gives the following error

Run-time error '1004':
Unable to set the Visible property of the Sheets class

This seems like an easy one, but I haven't been able to find an answer.

Thanks,
-Jeremy




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Hide/Unhide worksheets help

Thanks for the reply Ron.

So that means there's no way to do it without a loop?
My actual array is much larger.
I wonder why the hide works, but the unhide doesn't?

-Jeremy

Ron de Bruin wrote:
You can use this Jeremy

Dim sh As Worksheet
For Each sh In Sheets(Array("Sheet1", "Sheet2"))
sh.Visible = True
Next



"Jeremy Gollehon" wrote in message
...
Using OfficeXP.
In a fresh workbook from the immediate window...

This works.
Worksheets(Array("Sheet1", "Sheet2")).Visible = xlSheetHidden

This:
Worksheets(Array("Sheet1", "Sheet2")).Visible = xlSheetVisible

gives the following error

Run-time error '1004':
Unable to set the Visible property of the Sheets class

This seems like an easy one, but I haven't been able to find an
answer.

Thanks,
-Jeremy



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
Hide/Unhide worksheets upon entries in a range of the main worksheet ran58 Excel Discussion (Misc queries) 5 July 22nd 09 07:31 AM
Hide/Unhide row VBA Scafidel[_2_] Excel Discussion (Misc queries) 1 March 23rd 09 05:28 PM
How do I hide and unhide worksheets in Excel 2007? Wayne from Ottawa Canada Excel Discussion (Misc queries) 0 August 14th 06 02:54 AM
Hide Unhide Colin Excel Discussion (Misc queries) 4 April 9th 06 05:01 PM
Hide/unhide Jock W Excel Worksheet Functions 4 October 4th 05 05:02 PM


All times are GMT +1. The time now is 10:59 PM.

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"