+ Reply to Thread
Results 1 to 5 of 5

Write macro to move data to new sheets, depending on month

  1. #1
    Registered User
    Join Date
    11-20-2009
    Location
    Idaho
    MS-Off Ver
    Excel 2007
    Posts
    4

    Question Write macro to move data to new sheets, depending on month

    I am trying to write a macro so that if the value in Column A is in the month of November, the whole row goes to the sheet "Nov". If the value in Column A is in the month of December it goes to the sheet "Dec"...and so forth. The dates are in the format 11/28/09, etc. All of the data that I want to sort is in the worksheet "Today's Hedge Report". Please see attached file. Thank you!
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Write macro to move data to new sheets, depending on month

    Try this out:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    11-20-2009
    Location
    Idaho
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Write macro to move data to new sheets, depending on month

    Thank you for your help! The code worked for the most part, however it didn't work for June or September. Do you know why that would be? Or how to fix it?
    Also, is it possible to also separate them by year, so I can keep track of more than one year at a time?

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Write macro to move data to new sheets, depending on month

    I'm sure you've got an error in the sheet names or in the data itself. Did you name the sheet "Jun" or "June" ? The macro assumes the sheets are named the same way, 3 letter abbreviations.

    Feel free to upload a fuller sample sheet showing data/sheets that fail.

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Write macro to move data to new sheets, depending on month

    If you change your sheet names to:
    Nov09
    Dec09
    Jan10
    Feb10

    ...etc.

    Then this version of the macro will work for that:
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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