Would like to subtract 2 days from a date and set up time to 12 00,how to? hi al
ID: 3566934 • Letter: W
Question
Would like to subtract 2 days from a date and set up time to 12 00,how to?
hi all,,,
I came to maybe simple problem, but didnt find an answer on the internet.
Let say I have cell with day and time.
I am writing a macro which should change that cell. Change should be days minus 2 and time to be set up at 12 00. Is it possible somehow?
I tried combine to combine DateValue and TimeValue,...but no success
Sub time()
Dim y As Date
Dim x As Double
y = DateValue("C4"") - 2
x = TimeValue("12:00:00")
Range("C10") = yx
End Subb!
Explanation / Answer
Hi,,,
try
You were close, try this
Sub time()
Dim y As Date
Dim x As Double
y = DateValue(Range("C4")) - 2
x = TimeValue("12:00:00")
Range("C10") = y + x
End Subb!
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.