+ Reply to Thread
Results 1 to 6 of 6

Amend code to show previous month

  1. #1
    Spammer
    Join Date
    08-20-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    221

    Amend code to show previous month

    I have the following code below

    Please Login or Register  to view this content.

    It returns the following :

    Attached please find summary sales as at January 2018 vs the Prior Year



    I would like it to show the month and year relating to the previous month i.e 30 days less than the current month for eg if the current month is January 2018 it must return


    Attached please find summary sales as at December 2017 vs the Prior Year



    It would be appreciated if someone could kindly amend my code

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,434

    Re: Amend code to show previous month

    No attachment.

    Moved to VBA section.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Spammer
    Join Date
    08-20-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    221

    Re: Amend code to show previous month

    There is no attachment. I should have been clearer


    The text should read for eg "Attached please find summary sales as at December 2017 VS Prev Year" by amending the code to be 30 days less than the current month for eg if Current month is January 2018, that month and year to be Dec 2017

  4. #4
    Valued Forum Contributor
    Join Date
    12-22-2015
    Location
    HK
    MS-Off Ver
    2010
    Posts
    532

    Re: Amend code to show previous month

    Suggest:
    Formula:
    Please Login or Register  to view this content.
    or
    VBA
    Please Login or Register  to view this content.

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,588

    Re: Amend code to show previous month

    Please Login or Register  to view this content.

  6. #6
    Spammer
    Join Date
    08-20-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    221

    Re: Amend code to show previous month

    Hi Guys


    Thanks for the help. Your codes work perfectly

+ 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. Amend VBA code to 'undo' previous run results before re-running code
    By sllewe55 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-14-2017, 08:16 AM
  2. [SOLVED] Amend month number from its calendar value to a relative one.
    By Iolanthe in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-19-2017, 01:56 AM
  3. VBA code adjustment to include only current month and previous month automatically.
    By ElmerFud in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-05-2015, 03:02 PM
  4. Amend formula to take into account a variable(month)
    By nickmax1 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 09-18-2014, 10:32 AM
  5. [SOLVED] Formula to show change from previous month
    By karstens in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-06-2014, 03:35 PM
  6. [SOLVED] Open and show Previous Month
    By tommyfernandez in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-01-2013, 10:59 AM
  7. [SOLVED] How to amend the Y axis to just show the top and bottom of the range?
    By The_Snook in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 08-23-2012, 08:21 AM

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