+ Reply to Thread
Results 1 to 10 of 10

Macro to parse rows and columns and copy to respective worksheet

  1. #1
    Registered User
    Join Date
    11-30-2010
    Location
    Fort Myers, FL
    MS-Off Ver
    Excel 2003
    Posts
    5

    Thumbs up Macro to parse rows and columns and copy to respective worksheet

    Hello,

    First of all, thanks for helping with this. This is a great forum and resource.

    I'm working on a project where I have an "input" sheet and various sheets for clothing inventory/sizes.

    The input sheet has description and other misc data and inventory by size. (ie 10 units for size 6, 20 for size 7, so on)

    What would like to accomplish is to have a macro that will parse all inventory on the input sheet and copy all the size 6 products to the "6" sheet, and then size '7", "8", so on."

    To add more complexity, the input sheet might have sizes that vary between each product. ie shoes, mens will go from 7-12 and women from 5-10.

    And lastly, to combine all the different sizes/inventory to 1 sheet, showing the size of the the product on a column.

    Please see attached xls

    Thanks again!
    Attached Files Attached Files
    Last edited by martinmshin; 12-01-2010 at 11:24 AM.

  2. #2
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Macro to parse rows and columns and copy to respective worksheet

    martinmshin,

    Welcome to the Excel Forum.

    Detach/open workbook martinmshin - EF754984 - SDG15.xlsm and run macro CopyData.
    Attached Files Attached Files
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  3. #3
    Registered User
    Join Date
    11-30-2010
    Location
    Fort Myers, FL
    MS-Off Ver
    Excel 2003
    Posts
    5

    Thumbs up Re: Macro to parse rows and columns and copy to respective worksheet

    Hi Stan,

    thanks a lot for your help. Works great! I do have two more questions, could you change the range for data/descriptions to be from A-Z and size columns to be from AA to AZ (worksheets will be named from AA - AZ)? or show me where I need to tweak it?

    Lastly, is there anything I could do in return? do you have an amazon wish list?

    Thanks,

    Martin



    Quote Originally Posted by stanleydgromjr View Post
    martinmshin,

    Welcome to the Excel Forum.

    Detach/open workbook martinmshin - EF754984 - SDG15.xlsm and run macro CopyData.
    Last edited by martinmshin; 11-30-2010 at 03:26 PM.

  4. #4
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Macro to parse rows and columns and copy to respective worksheet

    Martin,

    You are very welcome.

    could you change the range for data/descriptions to be from A-Z and size columns to be from AA to AZ (worksheets will be named from AA - AZ)?
    Can you supply another workbook for testing in the new format?

  5. #5
    Registered User
    Join Date
    11-30-2010
    Location
    Fort Myers, FL
    MS-Off Ver
    Excel 2003
    Posts
    5

    Talking Re: Macro to parse rows and columns and copy to respective worksheet

    Attached is the example file. I only did products 1-5 and size fields AA-AE as an example but the macro should parse as many rows and size fields from AA-AZ exist. The first column (A) will always be populated, so if it's empty it should stop.

    I filled a lot of columns with "test" as some columns might have data. Sorry for how messy it looks, it's not pretty or easy on the eyes.

    Thanks again for all your efforts. They will save me hours, if not days!
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Macro to parse rows and columns and copy to respective worksheet

    Martin,

    Detach/open workbook martinmshin - EF754984 - V2 - SDG15.xlsm and run macro CopyDataV2.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    11-30-2010
    Location
    Fort Myers, FL
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Macro to parse rows and columns and copy to respective worksheet

    Thanks again Stan. There's a small issue. The "combined" sheet column AB has "Size Field 26-51". Rather than entering the text, could you do an offset to the size header ($AA$1) on sheets AA-AZ, I would like to capture whatever the ($AA$1) header is on sheets AA-AZ.

    Thanks a lot!

  8. #8
    Registered User
    Join Date
    11-30-2010
    Location
    Fort Myers, FL
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Macro to parse rows and columns and copy to respective worksheet

    I think I got it...

    Replaced this:
    Worksheets("combined").Range("AB" & NRC).Value = "Size Field " & b - 1

    with this:
    Worksheets("combined").Range("AB" & NRC).Value = Worksheets(ws).Range("AA1").Value


    Thanks so much Stan. I really appreciate it. This is a great macro!

  9. #9
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Macro to parse rows and columns and copy to respective worksheet

    Martin,

    Nice fix.


    Thanks again for all your efforts. They will save me hours, if not days!

    For my own personal information and record keeping:
    1. How much time do you think my macro will save you in hours per day/week/month?
    2. Please send your company name, phone number, and web site.

  10. #10
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Macro to parse rows and columns and copy to respective worksheet

    Martin,

    If your problem is solved, please say so clearly, and mark your thread as Solved: Click the Edit button on your first post in the thread, Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Edit button will not appear -- ask a moderator to mark it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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