VBA to Refresh cell back to certain date and time

DemonX

New Member
Joined
Jan 17, 2021
Messages
20
Office Version
  1. 2019
Platform
  1. Windows
I have made the following formula to calculate the time difference

1620572175602.png


using the following formula ;

=INT(B2-A2)&" Days "&HOUR(MOD(B2-A2,1))&" Hour "&MINUTE(MOD(B2-A2,1))&"minutes"

1620572200990.png


It would be great if anyone of you could help me with VBA to add into a button so I could reset values in Cell A2 and Cell B2 ( if need, to add more cells too ) back to default date and time value such as "01/01/2021 00:00"

Further, in the above formula, if I want to change the calculate structure from Month-Date-Year to Date-Month-Year , what are the changes I should do to =INT(B2-A2)&" Days "&HOUR(MOD(B2-A2,1))&" Hour "&MINUTE(MOD(B2-A2,1))&"minutes" ?

Appreciate any of kind assistance.
 

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.

Forum statistics

Threads
1,136,445
Messages
5,675,900
Members
419,591
Latest member
mersanko

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
Top