Help creating macro that runs another macro every 15 minutes, starting at 3:30 PM, and ending at 10:00 PM

smcmahon83

Board Regular
Joined
Jul 12, 2014
Messages
58
Hello,

I am struggling to create a macro that will automatically run another macro (code below), every 15 minutes, starting at 3:30 PM, ending at 10:00 PM only when the workbook is open.
Can anyone help me create this 'timer' macro that I need? Thanks a million in advance.

The macro below simply copies live data from one sheet, and pastes it transposed into a database sheet in the next available row.

-------------------------------

Sub Paster()
'
' Paster Macro
'
Sheets("TOS").Select
Range("Q1:Q21").Select
Selection.Copy
Sheets("Database").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues, Paste:=xlPasteFormats, Transpose:=True
ActiveWindow.SmallScroll Down:=-15
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
End Sub
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
try this:
VBA Code:
Sub nextcall()
timenow = Time()
 If timenow < TimeValue("15:30:00") Then
 Application.OnTime TimeValue("15:30:00"), "nextcall"
 Exit Sub
Else
 If timenow < TimeValue("22:00:00") Then
   Application.OnTime Now + TimeValue("0:15:00"), "nextcall"
 End If
End If
' call your sub here
call paster
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,035
Messages
6,122,785
Members
449,095
Latest member
m_smith_solihull

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