Rolling over Month & Year
Hi All
I'm trying to use a macro that rolls over an abbreviated month & year. I.e. Jan04 to Feb04
The cell the macro refers to is text formatted, and it needs to stay in that format
The problem i have is that when the macro rolls over to a new year it rolls over succesfully to Jan05 but then reverts back to Feb05
Can someone please help in the modify of the below code? I've tried several times but get constant errors
Cheers
Al
------------------
Sub NeDateChange(
Dim dtval As Dat
Const strYear2 As Integer = 200
strcmonth = Range("C3").Valu
strb2month = Left(strcmonth, 3
strYear = "20" & Right(strcmonth, 2
dtval = DateValue(strb2month & " 1," & strYear
strb3month = Format(DateSerial(strYear2, Month(dtval) + 1, 1), "mmmyy"
strnewmonth = Application.Substitute(strcmonth, Left(strcmonth, 5), strb3month
Range("C3").Value = strnewmont
End Su
|