I have a spreadsheet that runs every minute between 8am to 4pm that imports files from a certain folder and does certain calculations
The calculations are done to check if a limit has been breached. If a limit has been breached then the spreadsheet needs to notify the user through a sound alert and email alert. The requirement is for the sound alert to go off every minute while the email alert is supposed to go off every 45 minutes as they dont want to be spammed with emails.
public sub fileImport()
if between 0800 to 1600
//do file import
//do calculations
if breach sound alert
end if
Application.OnTime RunEveryMinute, fileImport
if there is a breach
sendMail()
Application.OnTime RunEvery45Min, sendMail
end if
public sub sendEmail()
//do email function
so how can i go about in calling the sendEmail sub only every 45 minutes instead of every minute?
Assuming this is in a loop just record the last send time and compare it to
Now;(This will send the very first time its invoked too)