Changing the date with macros

  • Thread starter Thread starter Dan
  • Start date Start date
D

Dan

Hi folks,

Here's my situation. I have a spreadsheet created to do
daily reporting.

In field B1 I have the date in the form of ' 8/3/04 ' I
have created a macro that will do all the mathematical
functions that I need on the sheet, but I can't get it to
turn the date over for me.

Could you please let me know how to change 8/3/04 to
8/4/04 and then 8/5/04, etc on each subsequent macro usage.

Additionally, if you could help me do the same with a name
like 'Monday' being changed to 'Tuesday' that would be
fantastic.

Thanks in advance for all the help, it is appreciated.
 
one way:

In your macro insert the line, or replace the line that assigns the date
with:

With Range("B1")
.Value = .Value + 1
End With
 
Dan,

That should be quite simple, but I am not sure which date system you're
using. I am assuming an American date system and what you want is to increase
the date by another day. Thus:

Sub chngDate()
Dim datee As Date
datee = Range("1")
datee = DateSerial(Year(datee), Month(datee), Day(datee) + 1)
Range("B1") = datee
End Sub

Now, if you format the date value on the cell to dddd it will give you the
full weekday name.
 
Back
Top