![]() |
Advance A Date By Month Or Year
Greetings,
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. Any help would be appreciated. TIA -Minitman |
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 =--- |
Advance A Date By Month Or Year
Thanks Dave,
I appreciate the reply, but that's not what I was looking for. It turns out all I needed was to look deeper into the TEXT() command and I came up with this where E3 is the date entry cell: =TEXT(E3+30, "mmm")&" 20, "&TEXT(E3+30, "yyyy") -Minitman On Sun, 16 Jan 2005 20:39:32 -0800, Dave D-C wrote: 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 =--- |
Advance A Date By Month Or Year
=Text(Date(year(e3),month(e3)+1,20),"mmm d, yyyy")
might be another way. -- Regards, Tom Ogilvy "Minitman" wrote in message ... Thanks Dave, I appreciate the reply, but that's not what I was looking for. It turns out all I needed was to look deeper into the TEXT() command and I came up with this where E3 is the date entry cell: =TEXT(E3+30, "mmm")&" 20, "&TEXT(E3+30, "yyyy") -Minitman On Sun, 16 Jan 2005 20:39:32 -0800, Dave D-C wrote: 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 =--- |
All times are GMT +1. The time now is 02:48 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com