VBA set a cell value in a time format

JezzaH

New Member
Joined
Jul 14, 2023
Messages
3
Office Version
  1. 365
Platform
  1. MacOS
Hey everyone,

Apologies if this is a really simple solution, but I cannot seem to find exactly what I am after online.

I wish to set the value of cell A1 to a value of 30 seconds. This is so I can have a countdown clock in my spreadsheet.

From my understanding the value is set in the hh:mm:ss format. It's not just a case of Range("A1").Value = 30

Thanks in advance for the help!

Cheers,

Jezza
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
VBA Code:
[A1].NumberFormat = "hh:mm:ss"
[A1] = TimeValue("00:00:30")
 
Upvote 0
Solution
Thankyou very much footoo!
The marked solution has been changed accordingly. In your future questions, please mark the post as the solution that actually answered your question, instead of your feedback message as it will help future readers. No further action is required for this thread.
 
Upvote 0

Forum statistics

Threads
1,215,487
Messages
6,125,085
Members
449,206
Latest member
ralemanygarcia

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