Solved

Advance date by one month

Posted on 2008-10-19
6
192 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

760 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

16 Experts available now in Live!

Get 1:1 Help Now