Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

increment a month 1

Status
Not open for further replies.

kingz2000

Programmer
May 28, 2002
304
DE
Hi,

I have in a given cell a date '01.07.2006' ,say, how do I add a month to it,so that it reads '01.08.2006' no matter what date is given in the cell..??

 
Could Try:
Code:
Range("B6").Formula = "=DATE(YEAR(B5),MONTH(B5)+1,DAY(B5))"

where B6 would be the target cell and B5 the date you wish to add a month to.

you could use a seperate cell to generate the new date as shown then copy the result into the origional cell.

works with dates xx/xx/xxxx don't appear to work xx.xx.xxxx
 
well, I'm working with cells..

the cell (5,60) is suuposed to be one month after (5,59)

the code
wks.Cells(4, 60) = Format(Year(wks.Cells(4, 59)), Month(wks.Cells(4, 59)) + 1, Day(wks.Cells(4, 59)))

doesn't work!!
 
and this:

wks.Cells(4, 60) = Format(DateSerial(Year(wks.Cells(4, 59)), Month(wks.Cells(4, 59)) + 1, Day(wks.Cells(4, 59))),"dd/mm/yyyy")


Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Try

wks.Cells(4, 60) = Dateserial(Year(wks.Cells(4, 59)), Month(wks.Cells(4, 59)) + 1, Day(wks.Cells(4, 59)))

Fen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top