Create a scrolling macro

FryGirl

Well-known Member
Joined
Nov 11, 2008
Messages
1,362
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
On my spreadsheet, I have cell C23542 highlighted as the activecell. I'm going to be reading down to row C23635 (or could be another range within column C). As I'm reading the text, I would like the screen to scroll until it hits the last cell, but with this code, the activecell never changes during the scroll, so I don't know how to exit as I reach the last cell. How can I achieve this scrolling?

VBA Code:
Sub CreateScrollDown()

    Dim lastrow As Long: lastrow = Range("A" & Rows.Count).End(xlUp).Row
    Dim StopPoint As Long: StopPoint = Range("MyEnd")
    
    While Intersect(Rows(lastrow), ActiveWindow.VisibleRange) Is Nothing
        Application.Wait (Now + TimeValue("0:00:01"))
        ActiveWindow.SmallScroll down:=Round(ActiveWindow.VisibleRange.Rows.Count / 5, 0)
    Wend
    Application.Wait (Now + TimeValue("0:00:03"))
    ActiveWindow.ScrollRow = 1
        
End Sub
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
How about
VBA Code:
Sub CreateScrollDown()

    Dim LastRow As Long, CurrRow As Long, r As Range
    
    LastRow = Range("C" & Rows.Count).End(xlUp).Row
    
    With ActiveWindow
        Do
            Set r = .VisibleRange
            CurrRow = r.Rows(r.Rows.Count).Row
            Application.Wait (Now + TimeValue("0:00:01"))
            .SmallScroll down:=Round(r.Rows.Count / 5, 0)
            
        Loop While CurrRow < LastRow
        
        Application.Wait (Now + TimeValue("0:00:03"))
        .ScrollRow = 1
    End With
End Sub
 
Upvote 0
Solution
Yes, that is perfect and will work for my needs. Thank you.
 
Upvote 0
You are welcome and thanks for letting me know.
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,432
Members
448,961
Latest member
nzskater

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