Change windows system date and time

Ed in Aus

Well-known Member
Joined
Jul 24, 2007
Messages
829
Hey does anyone know how to change the systemd date and time via a macro...

what I want to do is record the current date and time in the exact format that windows will take it back in and wind the clock back say ten years, then when the macro is run again or the second macro is run it restores the proper time
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hi,

Check out thiz UtterAccess-thread.

BTW: I would not recommend to alter your systemdate, can't you find a workaround of some kind?
 
Upvote 0
I cannot beleive how simple that is... the work around is doing it manually once a day, so I wanted to make it simpler.

All I have to do is

Code:
sub backtothefuture()
Dim MyDate
cells(1,1) = date()
MyDate = date()-365*10' ten years ago approx. Assign a date.
Date = MyDate ' Change system date.
end sub

Code:
sub futuretotheback()
Dim MyDate
mydate = cells(1,1)
Date = MyDate ' Change system date.
end sub

Run code 1 before what I need to do then code 2. Thanks for your help I was searching for hours
 
Upvote 0
Glad I could assist!

thumbup.gif
 
Upvote 0

Forum statistics

Threads
1,215,861
Messages
6,127,383
Members
449,382
Latest member
DonnaRisso

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