+ Reply to Thread
Results 1 to 2 of 2

Split worksheet into multiple worksheets based on value in column A (BUT more complicated)

  1. #1
    Forum Contributor
    Join Date
    10-03-2015
    Location
    North Carolina, USA
    MS-Off Ver
    Office 365
    Posts
    167

    Split worksheet into multiple worksheets based on value in column A (BUT more complicated)

    Ok, I have a doozy here. Or, at least, I think it is complicated!

    First, I have a macro that combines multiple workbooks from a folder on my desktop into a new single workbook. This works perfectly.

    Second, I have a macro that names each sheet based on the value in cell A2. This works perfectly.

    Here is my problem ... I thought that the value in cell A2 of each of my sheets was consistent down the column. It is not. Column A in all of my sheets contain Project numbers. I need one sheet per project number. Some sheets have only one project number, but others have multiple project numbers.

    Is it possible, with code, that the sheets with multiple project numbers can be split into multiple sheets, and the sheets that already only have one project code can be ignored? Also, each sheet has a header row, so that would also need to carry over to new sheets.

    If it is possible to do what I want, then I would need to run my macro for renaming all of the sheets afterward.

    I have almost everything else figured out for this project!!

    Thank you!

    .
    .
    PS. The number of columns can vary from one sheet to another. That is why I do not try to load all of the original workbooks into a single sheet of a new workbook, and then split them out. That would be too easy!

    PPS. Just to share, I do already have some code that splits one sheet into multiple sheets based on values in cells, but it works if starting with a single sheet, not multiple like in my request above. Anyway, I just thought I'd share that code in case it might give some value back to somebody:

    Please Login or Register  to view this content.
    Did not want to, but I am desperate: I sort of cross-posted at https://chandoo.org/forum/threads/sp...ontents.41060/ It's not exactly a cross-post, so I don't even know if I need to inform of it here, but I don't want my wrist slapped. Why is cross-posting even a problem? In life, don't we use all resources available to us? Seems silly, but whatever ... I want to be compliant.
    Last edited by carlito2002wgn; 02-28-2019 at 04:27 PM. Reason: Cross-post

  2. #2
    Forum Contributor
    Join Date
    10-03-2015
    Location
    North Carolina, USA
    MS-Off Ver
    Office 365
    Posts
    167

    Re: Split worksheet into multiple worksheets based on value in column A (BUT more complica

    Upon thinking more about this problem, I thought of a possible alternate solution. It would not be ideal, but it would work in the long run:

    Instead of splitting sheets with multiple project numbers into multiple sheets in the same workbook, would it be possible to parse all unique project numbers into unique workbooks, and save those to a specified folder? So, if sheet1 has one project number, and sheet2 has two project numbers, then the result would be three separate workbooks saved to the specified folder.

    Note, some project numbers are common across two sheets. That means that the macro would need to be able to handle that by adding an index to the name when saving the file (or whatever solution somebody smarter than me can think of :-) )

+ 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. [SOLVED] Need vba to split data into multiple worksheets based on column of P & save wb with FY 16
    By johnmacpro in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-02-2016, 05:47 AM
  2. Replies: 9
    Last Post: 08-25-2014, 04:52 PM
  3. [SOLVED] How to split worksheet into multiple worksheets based on column content
    By Laurelmzitney in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-03-2014, 10:57 AM
  4. Split data into multiple worksheets based upon a column in master worksheet
    By cep3927 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-07-2014, 10:38 AM
  5. Split a Worksheet into multiple Worksheets based off the DATA-SUBTOTAL
    By znpnh in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 01-18-2014, 04:06 PM
  6. How to split worksheet into multiple worksheets based on column content
    By jjexcels in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 11-05-2013, 11:42 AM
  7. [SOLVED] How to split worksheet into multiple worksheets based on column content
    By johnboytweed in forum Excel General
    Replies: 12
    Last Post: 10-16-2013, 12:01 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