PDA

View Full Version : Open to specific location of worksheet



energizek
10-30-2009, 05:50 PM
I am writting a program that has the user navigate through multiple worksheets within the workbook. It is important that the user see the top of the worksheet first (i.e. cell A1 should be in the upper left corner); however, there are several sheets that will open to the middle of the sheet for no apparent reason.

Is there an easier way to set Excel to open to the top row of each sheet?

Thanks!
Katie

lucas
10-30-2009, 06:38 PM
put this in the code for each sheet:
Private Sub Worksheet_Activate()
Range("A1").Select
End Sub

rbrhodes
10-30-2009, 06:51 PM
Also,



with activewindow
.scrollrow = 1
.scrollcolumn = 1
end with

RolfJ
10-30-2009, 09:29 PM
If you REALLY want to have cell A1 selected for each worksheet you nagivate to just place the following code in the ThisWorkbook VBA module:


Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Sh.Range("A1").Select
End Sub

rbrhodes
10-30-2009, 11:46 PM
not just selected...displayed I believe so scrollrow and scrollcolumn.

energizek
10-31-2009, 11:28 AM
Thank you so much! I've put it in ThisWorkbook and it runs perfectly!

RolfJ
10-31-2009, 07:03 PM
Hi dr:

I'd suggest you try my event handler to convince yourself that it is not neccessary to invoke any scrolling.