Solved

Advance date by one month

Posted on 2008-10-19
6
193 Views
Last Modified: 2013-11-25
Is there a VBA code that can look to a cell with a date entered in text format "Sep-07" for example and automatically change it to the next month in text format "Oct-07".  Then when it sees "Dec-07" it will change the datge to "Jan-08"?  The text format is iimportant because other cells refer to the date in text format to retrieve data.
0
Comment
Question by:ronadair
  • 2
  • 2
  • 2
6 Comments
 
LVL 59

Expert Comment

by:Saurabh Singh Teotia
ID: 22752625
What exactly you want to do...???

Saurabh...
0
 
LVL 59

Accepted Solution

by:
Chris Bottomley earned 250 total points
ID: 22752762
You can replace activecell with a specific address but try:

ActiveCell.Value = DateAdd("m", 1, ActiveCell)

Chris
0
 

Author Comment

by:ronadair
ID: 22752792
Chris -

I added the code, but it advanced the date to 10/7/2008.  I need it to advance one month and maintain text format to read Oct-08.

Ron
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 59

Assisted Solution

by:Saurabh Singh Teotia
Saurabh Singh Teotia earned 250 total points
ID: 22752804
A few changes in the chris code will do what you want...which is...

ActiveCell.Value = format(DateAdd("m", 1, ActiveCell),"mmm-yy")

Saurabh...
0
 

Author Closing Comment

by:ronadair
ID: 31507608
Thanks to each of you.  Worked like a charm!
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 22752854
Your welcome, thanks for the quick response ... I was about to post a change to ensure the correct number format of the cell but Saurab's way is good as well ... there being many ways to the same end.

Chris
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Hlookup formula help 14 20
sql server query from excel 3 57
ADD New Entries 7 16
Dynamic Filter ? 4 12
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now