Having problems with Variables within my macro.
Posted by Chris Rock on November 14, 2001 2:35 PM
I have a macro that I've had some help with. The code I was given finds the Prior Monday from the time when the macro runs (and if it runs on a Tuesday it goes back to the Monday before):
If Weekday(Now, 2) = 1 Then
Date_1 = Format(Now - 6, "mm-dd-yy")
Date_1 = Format(Now - (Weekday(Now, 2) + 6), "mm-dd-yy")
My variable is called "Date_1". I am trying to create a second variable called "Date_2" which basically represents the SUNDAY following the MONDAY represented by Date_1.
I thought all I had to do was say Date_2 = Date_1 + 6, but this isn't working. I get a "type mismatch" error.
How can I set this variable up so that VBA know that I want to take the Date_1 variable and just add 6 to get Date_2?
Thanks in advance for anyone who can show me.