LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
AL AL is offline
external usenet poster
 
Posts: 37
Default 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

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tell me which "season" (Month/Day through Month/Day) a date(Month/Day/Year) falls in (any year)??? misscrf Excel Discussion (Misc queries) 1 December 14th 07 02:59 PM
Rolling Year Tim Halpin (BV) Excel Discussion (Misc queries) 2 March 5th 07 12:07 PM
Rolling year Marilyn Excel Discussion (Misc queries) 2 June 18th 06 03:11 AM
How do I set up 12-month rolling month cells in excel? jbh Excel Discussion (Misc queries) 2 November 30th 05 08:12 PM
Rolling Year in Excel JJC Excel Discussion (Misc queries) 0 June 8th 05 11:21 PM


All times are GMT +1. The time now is 10:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"