+ Reply to Thread
Results 1 to 15 of 15

Splitting up data into separate sheets based on a column

  1. #1
    Registered User
    Join Date
    03-13-2014
    Location
    Las Vegas, Nevada
    MS-Off Ver
    Excel 2007
    Posts
    12

    Splitting up data into separate sheets based on a column

    Hi all,

    Decent with excel but horrible with macros. I've attached a demo of what I would like to do. I want to take column c as my identifier and use it to create worksheets with the same name and all the records that are associated in each matching row as well. In the example, I have "summary" as my before product and "sales/marketing/graphic design" sheets as the potential finished product. Any easy way to do this?

    Thank you.
    Attached Files Attached Files

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,893

    Re: Splitting up data into separate sheets based on a column

    Try this:

    Please Login or Register  to view this content.

    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    03-13-2014
    Location
    Las Vegas, Nevada
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Splitting up data into separate sheets based on a column

    No dice on that, the error message states:

    Compile error:
    Member already exists in an object module from which this object module derives.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,893

    Re: Splitting up data into separate sheets based on a column

    Which line of code is highlighted when you run debug. BTW: It ran without issue on my machine.

    Do you have Option Explicit listed twice at the top of the VBA? If so, then remove one of them.

    Alan

  5. #5
    Registered User
    Join Date
    03-13-2014
    Location
    Las Vegas, Nevada
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Splitting up data into separate sheets based on a column

    The first line, sub move() , and option explicit is only listed once.

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,893

    Re: Splitting up data into separate sheets based on a column

    mm? Here is my copy that works for me. Are you working in another workbook or in the one you supplied? If another workbook, what lines of code did you change? And if in another workbook, show the code you used.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    03-13-2014
    Location
    Las Vegas, Nevada
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Splitting up data into separate sheets based on a column

    Yours looks like its working because you already have sheets called "Marketing/Graphic Design/Etc..". When I run this every quarter, some of these fields will change. Is there a way to modify the macro to create sheets with unique identifiers as found in column C

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

    Re: Splitting up data into separate sheets based on a column

    Use AutoFilter...
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    03-13-2014
    Location
    Las Vegas, Nevada
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Splitting up data into separate sheets based on a column

    this works perfectly on my test spreadsheet, but when i move it over to my actual data that has 41 columns (with the key indicator in column 40), where do I change the code to use column AO as the column of choice?

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

    Re: Splitting up data into separate sheets based on a column

    Try change 3s to the col reference that you want
    1)
    Please Login or Register  to view this content.
    2)
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    03-13-2014
    Location
    Las Vegas, Nevada
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Splitting up data into separate sheets based on a column

    This is getting closer, it created the sheets based on column 40 like I wanted, but it didn't transfer any of the main data over. So I have a row of headers from the main data in A1:AO1 with nothing underneath in A2:A02

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

    Re: Splitting up data into separate sheets based on a column

    Then I need to see your actual data layouts.

  13. #13
    Registered User
    Join Date
    03-13-2014
    Location
    Las Vegas, Nevada
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Splitting up data into separate sheets based on a column

    Reattached the example. The column I would need to utilize is column 40 (department).
    Attached Files Attached Files

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

    Re: Splitting up data into separate sheets based on a column

    Working...
    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    03-13-2014
    Location
    Las Vegas, Nevada
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Splitting up data into separate sheets based on a column

    This works, thank you!

+ 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] Pulling Data to separate sheets based on one column
    By joliver in forum Excel General
    Replies: 10
    Last Post: 10-04-2013, 05:14 PM
  2. [SOLVED] Help: Splitting large workbook into separate workbooks based on R column value.
    By LightingPop in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-20-2013, 11:17 AM
  3. Splitting Data Into Separate Files Based on Pre-Populated List
    By sigma1113 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-16-2011, 03:20 PM
  4. splitting a long column of data into separate columns
    By michaelkwc in forum Excel Programming / VBA / Macros
    Replies: 29
    Last Post: 05-23-2008, 11:25 PM
  5. Splitting Data into separate sheets
    By bernard in forum Excel General
    Replies: 0
    Last Post: 12-02-2005, 12:35 PM

Tags for this Thread

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