Automatically Update a Cell for a Live Countdown

Summers2007

New Member
Joined
Dec 12, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I need help creating a countdown from $3,000,000 that auto updates every second to a lower number. I have the macro below that works for updating the sheet every second and it works. But I need the $3,000,000 to drop by $3.94 every second. Any ideas on a simple formula that will allow it to auto-update? Thanks in advance.

Sub CalculateNow()
'a5'
'i.e.
Calculate 'This recalculates all your cell values


Application.OnTime Now + TimeValue("00:00:01"), "CalculateNow"
End Sub
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
How about this ?
VBA Code:
Sub CalculateNow()
    'set A1=$3,000,000 before running the macro
    Range("A1") = Range("A1") - 3.94
    
    Application.OnTime Now + TimeValue("00:00:01"), "CalculateNow"
    
    If Range("A1") < 0 Then
        Application.OnTime Now + TimeValue("00:00:01"), "CalculateNow", Schedule:=False
        MsgBox "the end"
    End If
End Sub
 
Upvote 0
Solution
How about this ?
VBA Code:
Sub CalculateNow()
    'set A1=$3,000,000 before running the macro
    Range("A1") = Range("A1") - 3.94
   
    Application.OnTime Now + TimeValue("00:00:01"), "CalculateNow"
   
    If Range("A1") < 0 Then
        Application.OnTime Now + TimeValue("00:00:01"), "CalculateNow", Schedule:=False
        MsgBox "the end"
    End If
End Sub

Worked exactly as needed. Thank you.
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,117
Members
453,021
Latest member
Justyna P

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