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 |
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 . |
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 . |
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 . |
All times are GMT +1. The time now is 12:04 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com