View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave D-C[_3_] Dave D-C[_3_] is offline
external usenet poster
 
Posts: 176
Default Advance A Date By Month Or Year

Minitman wrote:
I have three cells. The first (A1) has a month listing and the
second (B1) has a year listing. I have CommandButtons to change the
months and the years, just not the code to make them work.


Is your question what to do with months 12?:
NewYear = OldYear + AddYears + (OldMonth + AddMonths-1) \ 12
NewMonth = 1 + (OldMonth + AddMonths - 1) mod 12
or, if you've already got the old..+add..= new..
NewYear = NewYear + (NewMonth-1) \ 12
NewMonth = 1 + (NewMonth - 1) mod 12



----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---