View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Code for positioning cursor in many sheets

Using the worksheet Activate event will position the cursor each time the
sheet is activated - this could be a major source of irritation to the user,
unless that it is your intent: that they be repositioned at E4 each time
they enter the sheet.

- If you only want this to occur when the workbook is opened put code in
the workbook_open event

Private Sub Workbook_Open()
Dim sh As Worksheet
Dim aSh As Worksheet
Set aSh = ActiveSheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
If IsNumeric(sh.Name) Then
Application.Goto _
Reference:=sh.Range("A1"), _
Scroll:=True
sh.Range("E4").Select
End If
Next
Application.ScreenUpdating = True
aSh.Select
End Sub

This puts A1 as the upper left corner with E4 selected. If you want E4 in
the upper left corner and selected, then change A1 to E4 and delete the line
sh.Range("E4").Select


Note that using notation like [E4] is three times as slow as using
Range("E4")

--
Regards,
Tom Ogilvy