Increasing cell date by a month
Hi Bob
Thankyou for your reply, it works AOK.
I must start typing dates when posting as 05-Oct-2004.
I feel Trevor and David missed the 5th day requirement of my post
due to this, my mistake.
Thanks again
regards Bob C
PS. Bob has "microsoft.public.excel.programming" closed down? I am
replying to you via Google Post a Message. I am receiving the "can not
connect to server" meassage for the last 20 hrs.
"Bob Phillips" wrote in message ...
Hi Bob,
Try this
Dim dt As Date
Dim mnth As Long
dt = Range("C2").Value
mnth = Month(dt)
If Day(dt) = 5 Then mnth = mnth + 1
Range("C2").Value = DateSerial(Year(dt), mnth, 5)
--
HTH
RP
"Robert Christie" wrote in message
...
Hi
Running the code below on cell C2 containing today's date
of 12-10-2004 changes cell value to 05-10-2004.
Running code a second time changes cell C2 value to 05-09-
2004
Dim dt As Date
dt = [C2].Value
[C2].Value = dt - Day(dt - 5)
How do you alter the code to achieve similar changes, but
increase the dates value?.
i.e. 01-10-2004 to 05-10-2004 run code again to increase
by a month to 05-11-2004.
TIA
Bob C
|