Programmatically scrolling to top

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
I have an Excel VBA app and I need automatically scroll to the top left
(cell A1) when each worksheet is selected and activated. I tried using the
Select, Activate and Show methods for the range in the Worksheet_Activate sub
but they didn't work.
Any ideas on a simple technique to do so?
Thanks, God bless
Van
 
Where did you put the code, and how did you write it? Sounds like the idea
should work; you would need to put the code in each worksheet's module,
though, to get it to work for every sheet. This code should work:

Private Sub Worksheet_Activate()

Range("A1").Select

End Sub
 
The following codes worked with me.
I think it should work with you too, if you do not have any sepcial stuff in
your sheets.

Private Sub Worksheet_Activate()
Range("A1").Select
End Sub

===== * ===== * ===== * =====
Daniel CHEN

(e-mail address removed)
www.Geocities.com/UDQServices
Free Data Processing Add-in<
===== * ===== * ===== * =====
 
Hi Van

The provided solutions will make A1 the selected cell. You may or may not
want that. If not, put this in the ThisWorkbook module:

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
ActiveWindow.ScrollColumn = 1
ActiveWindow.ScrollRow = 1
End Sub

HTH. Best wishes Harald
 
Thanks to all of you that replied.
As indicated the Select method doesn't work though it seems it should. Your
solutions David and Harald did, so appreciate you help.
God bless
Van
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top