+ Reply to Thread
Results 1 to 13 of 13

Macro To Advance Month

  1. #1
    Forum Contributor
    Join Date
    02-09-2004
    Location
    Cardiff - Wales - UK
    MS-Off Ver
    2013
    Posts
    475

    Question Macro To Advance Month

    Hi,

    Can anyone advise me of the macro code I need to advance my ‘Current Month’ formulas.

    What I have on the ‘Summary’ tab is the months of the year i.e. starting from ‘Oct’ to ‘Sep’ with formulas only in the ‘Average %’ and ‘Total’ cells in rows 7 & 8 respectively.

    What I require is a macro to :-

    (a) to copy the two formulas for the ‘Current Month’ i.e. in formulas in the cells in rows 7 & 8 into the next column and then move the text ‘Current Month’ (black on purple) to the next column

    (b) the previous formulas should then be converted from formulas to values i.e. override the formulas with the existing values

    (c) when the macro is run when the ‘Current Month’ is ‘Sep’ the formulas should then be copied to ‘Oct’ and the data for ‘Sep’ treated in (b) above

    (d) Finally, when the macro is run when the ‘Current Month’ is ‘Sep’ as in (c) above all the data for ‘Nov’ to ‘Sep’ should be deleted i.e. leaving blank cells

    Please see attached example ‘Annual.xlsx’ file

    Any assistance in this matter would be greatly appreciated

    Man thanks in advance

    Regards

    Rob

    N.B. Excel versions being used 2010 & 2013
    Attached Files Attached Files
    Rob

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro To Advance Month

    Hi Robert,

    Try this and let me know:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Contributor
    Join Date
    02-09-2004
    Location
    Cardiff - Wales - UK
    MS-Off Ver
    2013
    Posts
    475

    Re: Macro To Advance Month

    xladept,

    man thanks for your reply it is very much appreciated, unfortunately nothing seems to happen !! I've checked to see if macros are enabled but still nothing happens ! Any Ideas ?

    Rob

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro To Advance Month

    Well since the Current Month is filled in nothing should happen - I tested it by changeing the month -

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    02-09-2004
    Location
    Cardiff - Wales - UK
    MS-Off Ver
    2013
    Posts
    475

    Re: Macro To Advance Month

    xladept,

    thanks for the revised code which worked once i.e. it advanced the month from 'Nov' to 'Dec', however, when I ran it again nothing happened ! What I require is for the macro to run every time you run it, so I guess the macro must check every time which cell has the text 'Current Month' in order to advance the month.

    Any ideas ?

    Regards

    Rob

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro To Advance Month

    Hi Robert,

    You can just change the red date - or I could rewrite the program to always advance the month

  7. #7
    Forum Contributor
    Join Date
    02-09-2004
    Location
    Cardiff - Wales - UK
    MS-Off Ver
    2013
    Posts
    475

    Re: Macro To Advance Month

    xladept,,

    is it possible you could amend your code to always advance the month...if you could I would be very grateful...


    Many thanks...

    Rob

  8. #8
    Forum Contributor
    Join Date
    02-09-2004
    Location
    Cardiff - Wales - UK
    MS-Off Ver
    2013
    Posts
    475

    Re: Macro To Advance Month

    Any ideas or suggestions would be very much appreciated

  9. #9
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro To Advance Month

    Hi Rob,

    Try:

    Please Login or Register  to view this content.
    *I must apologize for the delay in response. In my defense, but no real excuse, is the fact that this forum’s e-mail notification feature has been inoperative for an intolerable amount of time. I knew that but only now have I decided to check the status of the threads to which I’ve contributed. Sorry

  10. #10
    Forum Contributor
    Join Date
    02-09-2004
    Location
    Cardiff - Wales - UK
    MS-Off Ver
    2013
    Posts
    475

    Re: Macro To Advance Month

    xladept,

    many thanks again for reply, we're almost there. I updated your code in my workbook and it does advance the month as requested, however, when the 'Current Month' is September and you run the macro again it does copy the formulas to 'Oct' and delete all the data for the months 'Nov' to 'Aug' (as required) but unfortunately it does not delete the data for 'Sep'.

    Could I trouble again to take another look?


    Many thanks

    Regards

    Rob

  11. #11
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro To Advance Month

    Hi Rob,

    Just comment out that line for Sep:

    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    02-09-2004
    Location
    Cardiff - Wales - UK
    MS-Off Ver
    2013
    Posts
    475

    Re: Macro To Advance Month

    xladept,

    BINGO !! Once again you have nailed it !!

    Excellent, many thanks for all your assistance it is 'Very' much appreciated

    Regards


    Rob

  13. #13
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro To Advance Month

    You're welcome and thanks for the rep!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro to advance Graph Ranges To Accommodate new month
    By robertguy in forum Excel General
    Replies: 2
    Last Post: 08-29-2014, 03:07 AM
  2. Macro won't advance to next set in spreadsheet
    By nkimball in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-05-2014, 08:01 AM
  3. Advance Filter Macro
    By johncena in forum Excel General
    Replies: 3
    Last Post: 03-21-2010, 06:14 AM
  4. Advance to new month macro???
    By pril in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-29-2008, 09:08 AM
  5. Advance Dates Macro
    By robert_shindorf in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-05-2008, 07:17 PM
  6. Advance Code or macro
    By yobi4ever in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-09-2007, 09:28 PM
  7. [SOLVED] Advance A Date By Month Or Year
    By Minitman in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-17-2005, 04:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1