LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 202
Default Set Active Cell to A1 on Open Q

On Feb 16, 11:00*am, GS wrote:
on 2/16/2011, Seanie supposed :





I have the code below which moves all sheets active cell to A1, but
how do I tweak to also do so when I have hidden worksheets? Currently
it debugs as I have some sheets hidden


Private Sub Workbook_Open()
Application.ScreenUpdating = False
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
* sh.Select
* Application.Goto Reference:=sh.Range("a1"), Scroll:=True
Next sh
ThisWorkbook.Sheets("Month").Select
Application.ScreenUpdating = True


End Sub


Don't select the sheets.

* Private Sub Workbook_Open()
* * Dim sh As Worksheet
* * With Application
* * *.ScreenUpdating = False
* * * For Each sh In ThisWorkbook.Worksheets
* * * * If sh.Visible Then
* * * * * .Goto Reference:=sh.Range("a1"), Scroll:=True
* * * * Else
* * * * * sh.Visible = xlSheetVisible
* * * * * .Goto Reference:=sh.Range("a1"), Scroll:=True
* * * * * sh.Visible = xlSheetHidden
* * * * End If
* * * Next sh
* * * .ScreenUpdating = True
* * End With '//Application
* * ThisWorkbook.Sheets("Month").Select
* End Sub

--
Garry

Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc- Hide quoted text -

- Show quoted text -


Thanks
 
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
When I open a workbook, cell protection is not fully active Dave_B_at C&W Excel Worksheet Functions 0 February 4th 09 10:42 AM
When open move active cell JDH Excel Programming 3 April 5th 08 05:19 PM
Why does a new Excel Workbook open with IV1 as the active cell? pjwing Excel Discussion (Misc queries) 1 July 3rd 07 11:26 PM
Active cell as a reference to open a worksheet LaDdIe Excel Worksheet Functions 6 March 15th 07 07:06 PM
Open validationlist when cell is active Filips Benoit Excel Programming 1 November 11th 06 04:28 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"