Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Hidden Worksheet Error

Sub Auto_Open()
Application.ScreenUpdating = False
For Each ws In Worksheets
if ws.Visible = xlSheetVisible then
ws.Select
Application.Goto ws.Range("A1"), True
End if
Next
Worksheets("Scorecard").Select
Application.ScreenUpdating = True
End Sub

Note the ws.Select is redundant if you use application.Goto (this selects
the sheet, goes to the cell, scrolls it to the upper left corner).

Regards,
Tom Ogilvy

"Phil Hageman" wrote in message
...
In a workbook module, the following code successfully
places the cursor in cell A1 of each worksheet, makes each
worksheet cell A1 visible on screen, and opens the
workbook on the worksheet "Scorecard". Other worksheets
are "Customer", "Financial", etc.

Sub Auto_Open()
Application.ScreenUpdating = False
For Each ws In Worksheets
ws.Select
Application.Goto ws.Range("A1"), True
Next
Worksheets("Scorecard").Select
Application.ScreenUpdating = True
End Sub

Hiding a worksheet (FormatSheetHide), in this case
hiding "Financial", causes:

Run-time error '1004':
Select method of Worksheet class failed
Yellow arrow/yellow highlight on line: ws.select

How do I deal with hiding/unhiding worksheets?

Thanks, Phil



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Hidden Worksheet Error

Thanks, Tom. It works just as needed.
-----Original Message-----
Sub Auto_Open()
Application.ScreenUpdating = False
For Each ws In Worksheets
if ws.Visible = xlSheetVisible then
ws.Select
Application.Goto ws.Range("A1"), True
End if
Next
Worksheets("Scorecard").Select
Application.ScreenUpdating = True
End Sub

Note the ws.Select is redundant if you use

application.Goto (this selects
the sheet, goes to the cell, scrolls it to the upper left

corner).

Regards,
Tom Ogilvy

"Phil Hageman" wrote in message
...
In a workbook module, the following code successfully
places the cursor in cell A1 of each worksheet, makes

each
worksheet cell A1 visible on screen, and opens the
workbook on the worksheet "Scorecard". Other worksheets
are "Customer", "Financial", etc.

Sub Auto_Open()
Application.ScreenUpdating = False
For Each ws In Worksheets
ws.Select
Application.Goto ws.Range("A1"), True
Next
Worksheets("Scorecard").Select
Application.ScreenUpdating = True
End Sub

Hiding a worksheet (FormatSheetHide), in this case
hiding "Financial", causes:

Run-time error '1004':
Select method of Worksheet class failed
Yellow arrow/yellow highlight on line: ws.select

How do I deal with hiding/unhiding worksheets?

Thanks, Phil



.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Hidden Worksheet Error

Tom,

In this code, how would I additionally toggle grid off, as
each worksheet is addressed?

Phil
-----Original Message-----
Sub Auto_Open()
Application.ScreenUpdating = False
For Each ws In Worksheets
if ws.Visible = xlSheetVisible then
ws.Select
Application.Goto ws.Range("A1"), True
End if
Next
Worksheets("Scorecard").Select
Application.ScreenUpdating = True
End Sub

Note the ws.Select is redundant if you use

application.Goto (this selects
the sheet, goes to the cell, scrolls it to the upper left

corner).

Regards,
Tom Ogilvy

"Phil Hageman" wrote in message
...
In a workbook module, the following code successfully
places the cursor in cell A1 of each worksheet, makes

each
worksheet cell A1 visible on screen, and opens the
workbook on the worksheet "Scorecard". Other worksheets
are "Customer", "Financial", etc.

Sub Auto_Open()
Application.ScreenUpdating = False
For Each ws In Worksheets
ws.Select
Application.Goto ws.Range("A1"), True
Next
Worksheets("Scorecard").Select
Application.ScreenUpdating = True
End Sub

Hiding a worksheet (FormatSheetHide), in this case
hiding "Financial", causes:

Run-time error '1004':
Select method of Worksheet class failed
Yellow arrow/yellow highlight on line: ws.select

How do I deal with hiding/unhiding worksheets?

Thanks, Phil



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Hidden Worksheet Error

Sub Auto_Open()
Application.ScreenUpdating = False
For Each ws In Worksheets
if ws.Visible = xlSheetVisible then
ws.Select
Application.Goto ws.Range("A1"), True
ActiveWindow.DisplayGridlines = False
End if
Next
Worksheets("Scorecard").Select
Application.ScreenUpdating = True
End Sub


--
Regards,
Tom Ogilvy

"Phil Hageman" wrote in message
...
Tom,

In this code, how would I additionally toggle grid off, as
each worksheet is addressed?

Phil
-----Original Message-----
Sub Auto_Open()
Application.ScreenUpdating = False
For Each ws In Worksheets
if ws.Visible = xlSheetVisible then
ws.Select
Application.Goto ws.Range("A1"), True
End if
Next
Worksheets("Scorecard").Select
Application.ScreenUpdating = True
End Sub

Note the ws.Select is redundant if you use

application.Goto (this selects
the sheet, goes to the cell, scrolls it to the upper left

corner).

Regards,
Tom Ogilvy

"Phil Hageman" wrote in message
...
In a workbook module, the following code successfully
places the cursor in cell A1 of each worksheet, makes

each
worksheet cell A1 visible on screen, and opens the
workbook on the worksheet "Scorecard". Other worksheets
are "Customer", "Financial", etc.

Sub Auto_Open()
Application.ScreenUpdating = False
For Each ws In Worksheets
ws.Select
Application.Goto ws.Range("A1"), True
Next
Worksheets("Scorecard").Select
Application.ScreenUpdating = True
End Sub

Hiding a worksheet (FormatSheetHide), in this case
hiding "Financial", causes:

Run-time error '1004':
Select method of Worksheet class failed
Yellow arrow/yellow highlight on line: ws.select

How do I deal with hiding/unhiding worksheets?

Thanks, Phil



.



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
2007 Worksheet, Hidden Columns, .CSV Format Saves Hidden Column Da Tammy Excel Discussion (Misc queries) 3 April 2nd 09 11:40 PM
Hidden Columns No Longer Hidden after Copying Worksheet? EV Nelson Excel Discussion (Misc queries) 1 December 6th 06 05:10 PM
How do I detect hidden worksheets or hidden data on a worksheet? Alice Excel Discussion (Misc queries) 4 August 24th 06 03:38 AM
Compile error in hidden module arjay Excel Discussion (Misc queries) 5 September 16th 05 12:47 AM
How do I get rid of "Compile error in hidden module" error message David Excel Discussion (Misc queries) 4 January 21st 05 11:39 PM


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