Macro to page down every 5 minutes?

Hydra427

New Member
Joined
Jan 17, 2017
Messages
3
Can someone help me with the code to automatically page down every 5 minutes until the last record is reached and then return to the top and start over. I have a spreadsheet that automatically updates (refreshes) every 15 minutes and want it to automatically page down every 5 minutes so that the shop can see the latest inventory to pull.
 

Some videos you may like

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Hydra427

New Member
Joined
Jan 17, 2017
Messages
3
All right, I have figured out how to page down every :30 but need to to repeat the page down until it reaches the last record and then return to the first record and continue. This must also work as the spreadsheet automatically refreshes every 15 minutes. Here is the code I am using to page down.

Sub Macro1()
'
' Macro1 Macro
'
'
Range("A1").Select
Application.Wait (Now + TimeValue("0:00:30"))
ActiveWindow.LargeScroll Down:=1


End Sub
 

John_w

MrExcel MVP
Joined
Oct 15, 2007
Messages
6,625
Try this code in a standard module. It looks in column A to determine the last row, so change the "A" in the code to use a different column.

Code:
Option Explicit

Public RunWhen As Double

Public Sub StartTimer()
    RunWhen = Now + TimeValue("00:00:30")
    Application.OnTime EarliestTime:=RunWhen, Procedure:="Page_Down", Schedule:=True
End Sub

Public Sub StopTimer()
    On Error Resume Next
    Application.OnTime EarliestTime:=RunWhen, Procedure:="Page_Down", Schedule:=False
End Sub

Public Sub Page_Down()

    Dim lastRow As Long
    
    lastRow = Cells(Rows.Count, "A").End(xlUp).Row
    ActiveWindow.LargeScroll Down:=1
    If ActiveWindow.ScrollRow > lastRow Then ActiveWindow.ScrollRow = 1
    
    StartTimer
        
End Sub
Run or call StopTimer to stop the scrolling (e.g. from a command button), and put this code in the ThisWorkbook module to stop the timer when you close the workbook:
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
    StopTimer
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,123,481
Messages
5,601,918
Members
414,482
Latest member
morkar

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