Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Scroll to top of page code


I have a worksheet where the first 6 rows are 'frozen'

When a worksheet is activated, I would like the sheet to be 'scrolled
to the top. Tired Range.("A7").select, however the worksheet does no
scroll to the top.

Would appreciate anyone helping with the suggested code to make thi
happen.

Cheers

Peter (new to VBA

--
peter.thompso
-----------------------------------------------------------------------
peter.thompson's Profile: http://www.excelforum.com/member.php...fo&userid=2968
View this thread: http://www.excelforum.com/showthread.php?threadid=50153

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 227
Default Scroll to top of page code

Enter this code in the sheet in question:

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Scroll to top of page code


Hi Mark, I've tried that, the cursor moves to the cell, but the page
doesn't 'scroll up' for some reason...

Cheers

Peter


--
peter.thompson
------------------------------------------------------------------------
peter.thompson's Profile: http://www.excelforum.com/member.php...o&userid=29686
View this thread: http://www.excelforum.com/showthread...hreadid=501532

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Scroll to top of page code

Hi Peter,

Try:

'=============
Private Sub Worksheet_Activate()
Application.Goto Reference:=Range("A7"), Scroll:=True
End Sub
'<<=============

This is worksheet event code and should be pasted into the worksheets's code
module (not a standard module and not the workbook's ThisWorkbook module):

Right-click the worksheet's tab
Select 'View Code' from the menu and paste the code.
Alt-F11 to return to Excel.


---
Regards,
Norman


"peter.thompson"
<peter.thompson.21paum_1137370203.5501@excelforu m-nospam.com wrote in
message news:peter.thompson.21paum_1137370203.5501@excelfo rum-nospam.com...

I have a worksheet where the first 6 rows are 'frozen'

When a worksheet is activated, I would like the sheet to be 'scrolled'
to the top. Tired Range.("A7").select, however the worksheet does not
scroll to the top.

Would appreciate anyone helping with the suggested code to make this
happen.

Cheers

Peter (new to VBA)


--
peter.thompson
------------------------------------------------------------------------
peter.thompson's Profile:
http://www.excelforum.com/member.php...o&userid=29686
View this thread: http://www.excelforum.com/showthread...hreadid=501532



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Scroll to top of page code


Thanks Norman, that did it.

Cheers

Peter


--
peter.thompson
------------------------------------------------------------------------
peter.thompson's Profile: http://www.excelforum.com/member.php...o&userid=29686
View this thread: http://www.excelforum.com/showthread...hreadid=501532



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 227
Default Scroll to top of page code

Peter, I'm puzzled -- I get the same behavior both with my code and
with Norman's, and I've never had mine fail in use in any worksheet in
which I've used it.

I'm curious as to why my code didn't work for you. Did you run it in
the worksheet's code module?

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Scroll to top of page code


Hi Mark,

Am doing a few other things at the same time, see code below. Probabl
why it isn't working in this scenario. Unfortunately I'm too much of
newbie to figure out why!

Sincerely appreciate your asistance.

Public Sub Worksheet_Activate()
Application.ScreenUpdating = False
Password = "djdog"
ActiveSheet.Unprotect Password
Cells.Select
Selection.EntireRow.Hidden = False
Application.Goto Reference:=Range("A7"), Scroll:=True


Cheers

Pete

--
peter.thompso
-----------------------------------------------------------------------
peter.thompson's Profile: http://www.excelforum.com/member.php...fo&userid=2968
View this thread: http://www.excelforum.com/showthread.php?threadid=50153

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 227
Default Scroll to top of page code

Public Sub Worksheet_Activate()
Application.ScreenUpdating = False
Password = "djdog"
ActiveSheet.Unprotect Password
Cells.Select
Selection.EntireRow.Hidden = False
Application.Goto Reference:=Range("A7"), Scroll:=True


Peter, I don't know for sure, but I'd think turning off ScreenUpdating
is keeping your original code from working. I've never needed to keep
the screen from updating while using my code. Norman's code forces the
scrolling where your original code (and mine) do not.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do you have the headings scroll down the page as you move dow Donna B Excel Worksheet Functions 2 May 16th 10 09:24 AM
How do I get my arrows to scroll the cells not the page? Chistine Excel Discussion (Misc queries) 2 November 22nd 05 04:20 PM
how to have my titles move down as i scroll down the page DAVIDPEOVER Excel Discussion (Misc queries) 1 May 26th 05 12:31 PM
Moving Page with Scroll Bar CMM Excel Discussion (Misc queries) 1 March 1st 05 07:07 AM
VBA code to scroll all the way to the top lothario[_32_] Excel Programming 3 October 23rd 03 12:35 PM


All times are GMT +1. The time now is 12:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"