Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 336
Default Set curser to Same position on open

I have a workbook with 3 pages. How can I set the curser on each page to a
starting position of cell A1 when the workbook is opened? Preferably,
something to the number of sheets in the workbook as they may fluctuate.

Thank you,
--
Martin
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Set curser to Same position on open

In the ThisWorkbook module add the following Workbook_Open event.

Private Sub Workbook_Open()

Dim sh As Worksheet
Dim thisSh As Worksheet

On Error GoTo Event_Exit

Set thisSh = ActiveSheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
sh.Activate
Application.Goto Range("A1"), True
Next sh
thisSh.Activate
Event_Exit:
Application.ScreenUpdating = True
End Sub

Hope this helps
Rowan

Martin wrote:
I have a workbook with 3 pages. How can I set the curser on each page to a
starting position of cell A1 when the workbook is opened? Preferably,
something to the number of sheets in the workbook as they may fluctuate.

Thank you,

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Set curser to Same position on open

hi Martin

1. Select the ThisWorkbook sheet in the VBA Editor.
2. Paste in the following code.

Private Sub Workbook_Open()

Dim wksSheet As Excel.Worksheet

For Each wksSheet In ThisWorkbook.Sheets
If wksSheet.Type = xlWorksheet Then
wksSheet.Activate
wksSheet.Range("A1").Activate
End If
Next

ThisWorkbook.Sheets(1).Activate

End Sub

Each time you open the workbook it will put the cursor for each sheet back
to A1. It doesn't matter how many sheets you have in the workbook.

HTH

Barry


"Martin" wrote:

I have a workbook with 3 pages. How can I set the curser on each page to a
starting position of cell A1 when the workbook is opened? Preferably,
something to the number of sheets in the workbook as they may fluctuate.

Thank you,
--
Martin

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
change default file open position for large shared spreadhseet Frustrated in NJ Excel Discussion (Misc queries) 1 February 18th 10 03:24 PM
Position to first empty cell upon program open Savannah Excel Discussion (Misc queries) 5 October 27th 08 07:23 PM
spreadsheet Curser Shanny Excel Discussion (Misc queries) 1 May 29th 07 08:46 PM
Default cell position on file open Chandramouly Excel Discussion (Misc queries) 2 March 9th 07 07:32 PM
Position of CellCursor on Screen (absolute position) [email protected] Excel Programming 1 November 23rd 05 02:23 AM


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