+ Reply to Thread
Results 1 to 4 of 4

Split Data Into Seprate Sheets By Criteria

  1. #1
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Split Data Into Seprate Sheets By Criteria

    Hello all,

    I've seen this question come up a few times, "How do I split data from a master sheet into separate sheets?"
    I created a macro that is a bit generic so that users can adapt it to their needs.
    Here is the macro code:
    Please Login or Register  to view this content.

    How to use a macro:
    1. Make a copy of the workbook the macro will be run on
      • Always run new code on a workbook copy, just in case the code doesn't run smoothly
      • This is especially true of any code that deletes anything
    2. In the copied workbook, press ALT+F11 to open the Visual Basic Editor
    3. Insert | Module
    4. Copy the provided code and paste into the module
    5. Close the Visual Basic Editor
    6. In Excel, press ALT+F8 to bring up the list of available macros to run
    7. Double-click the desired macro (I named this one SplitDataIntoSheetsByCriteria)
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Split Data Into Seprate Sheets By Criteria

    It was suggested to me that the code could be made to prompt the user to select the criteria column at run-time instead of using constants at the top of the code. Here is a version that prompts the user:
    Please Login or Register  to view this content.

    Credit to the suggestion goes to jeffreybrown, thanks Jeff!

  3. #3
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Split Data Into Seprate Sheets By Criteria

    I received this Private Message from dfulmer:
    Quote Originally Posted by dfulmer
    Hi tigeravatar,

    I have been trying to figure out a way to split data into separate sheets based on one criteria all day and then was given a link to your macro. It initially works great - everything sorted fine. However, my main sheet of data will constantly be updated and/or edited and when I re-ran the macro, it didn't move any updates that were made.

    Any thoughts?

    I looked over the code and realized that if the sheet name already exists, then it does not actually move the data to the existing sheet. This 3rd version addresses that issue:
    Please Login or Register  to view this content.


    Thank you for pointing that, dfulmer!

  4. #4
    Registered User
    Join Date
    03-23-2016
    Location
    Australia
    MS-Off Ver
    Excel
    Posts
    3

    Re: Split Data Into Seprate Sheets By Criteria

    Is it possible, to run multiple macro's at the same time. So different criteria columns go to different tabs?

    Thanks!
    C

+ 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