Opening worksheets in cell A1

scouse

Board Regular
Joined
Jan 16, 2004
Messages
207
I have the following code in My Workbook. It is supposed to do two things:

1) Ensure the User always goes to the opening worksheet (Top) when they open up the workbook

2) Ensure the user always goes to cell A1 of each worksheet when they open each worksheet


Private Sub Workbook_Open()
Sheets("Top").Select
Dim X As Integer

Application.ScreenUpdating = False
For X = 1 To Sheets.Count
If Sheets(X).Visible = True Then
Sheets(X).Select
Range("A1").Select
End If
Next X
Sheets(1).Select
Application.ScreenUpdating = True
End Sub


It does number 1 but doesnt do number two - can anyone help with the code

regards

Scouse
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

SIXTH SENSE

Well-known Member
Joined
Oct 29, 2003
Messages
1,883
hi!
on each worksheet paste this code!

Code:
Private Sub Worksheet_Activate()
Range("a1").Select
End Sub
 

Mudface

MrExcel MVP
Joined
Feb 18, 2002
Messages
3,339
As an alternative to putting it into each worksheet module, you can also put code in the ThisWorkbook module to apply to all sheets-

Code:
Private Sub Workbook_SheetActivate(ByVal Sh As Object)

On Error Resume Next ' In case it's a chart sheet
Sh.Range("A1").Select

End Sub
 

Forum statistics

Threads
1,186,168
Messages
5,956,337
Members
438,247
Latest member
UZev

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top