Start Macro if Timer Less Than 10 Minutes

andybason

Board Regular
Joined
Jan 7, 2012
Messages
217
Office Version
  1. 2016
Hello

I have a sheet that contains a countdown timer in D2 (in hh:mm:ss format) that is populated by external software. The sheet also has a change event macro that runs when E2 contains something:

VBA Code:
If ThisWorkbook.Worksheets("Attendance").Range("E2") <> ""

Is it possible to add a condition that the macro only runs when the timer is also less than 10 minutes to go?

Thank you
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Try this:
VBA Code:
    With ThisWorkbook.Worksheets("Attendance")
        If .Range("E2").Value <> "" And .Range("D2").Value < TimeValue("00:10:00") Then
        
        End If
    End With
 
Upvote 0
Actually, I just noticed that when the timer reaches negative time values the macro stops running. Often it will go below 00:00:00. Is there a way of allowing the macro to continue in these circumstances? Thanks
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,037
Members
449,062
Latest member
mike575

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