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

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
hi!
on each worksheet paste this code!

Code:
Private Sub Worksheet_Activate()
Range("a1").Select
End Sub
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,608
Messages
6,120,500
Members
448,968
Latest member
screechyboy79

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
Back
Top