Code so when worksheet is opened, it scrolls to top of page.

wudhus_kid

New Member
Joined
Aug 8, 2007
Messages
31
I would like a code so when a tab is clicked to open a worksheet, the worksheet is scrolled to the top of the page, as opposed to being wherever it was left by the previous user.

Any help would be much appreciated.

Many Thanks
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
59,294
Office Version
  1. 365
Platform
  1. Windows
wudhus_kid

Try this. Your description just says to the top of the page but doesn't mention scrolling to the left hand side as well. Therefore, you may not want the ScrollColumn line in this code.

If it doesn't do what you want, post back with further details.

<font face=Courier New><SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Worksheet_Activate()
    <SPAN style="color:#00007F">With</SPAN> ActiveWindow
        .ScrollRow = 1
        .ScrollColumn = 1
    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>
 
Upvote 0

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
In the module for the worksheet:

Code:
Private Sub Worksheet_Activate()
    Application.Goto Range("A1"), True
End Sub
 
Upvote 0

Forum statistics

Threads
1,190,602
Messages
5,981,883
Members
439,742
Latest member
bluegreen

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