+ Reply to Thread
Results 1 to 12 of 12

Need help with macro for converting data

  1. #1
    Forum Contributor
    Join Date
    09-12-2012
    Location
    Michigan
    MS-Off Ver
    Excel 2007
    Posts
    127

    Need help with macro for converting data

    anyone have know how to convert the following source data that looks like this:

    5105473, 5105474, 5105475 batch 12/21/2012 187836




    where 5105473, 5105474, 5105475 is in column A, batch is in column B, 12/21/2012 is in column C and 187836 is in column D


    goal is to return 3 rows and 4 columns that look like this:

    5105473 batch 12/21/2012 187836
    5105474 batch 12/21/2012 187836
    5105475 batch 12/21/2012 187836

    needs to be dynamic, values in column A can vary 2-20 values
    total number of rows can also vary

    thanks in advance

  2. #2
    Registered User
    Join Date
    11-15-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Need help with macro for converting data

    Here's a quick suggestion:
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    09-12-2012
    Location
    Michigan
    MS-Off Ver
    Excel 2007
    Posts
    127

    Re: Need help with macro for converting data

    sullivan372,

    Thanks for the code, I follow the logic but when I try to execute the macro it doesn't do anything. Any suggestions?

  4. #4
    Registered User
    Join Date
    11-15-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Need help with macro for converting data

    Sorry for the delayed response - The first things that come to mind are:
    -You need to rename the sheets in the code to whatever yours are named
    -Your first row is blank meaning the loop only executes once, on nothing

    Check these things and let me know if you had already solved it. Otherwise, it would be easiest if you can post your file, so I can test it directly.

  5. #5
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: Need help with macro for converting data

    What are the values in column A separated by?
    Comma
    5105473, 5105474, 5105475

    Space
    5105473 5105474 5105475

    SemiColon
    5105473; 5105474; 5105475
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  6. #6
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: Need help with macro for converting data

    Give this a try

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    09-12-2012
    Location
    Michigan
    MS-Off Ver
    Excel 2007
    Posts
    127

    Re: Need help with macro for converting data

    Thanks for getting back to me. I did replace the tab in the the macro and there's not a blank row first. The file I'm working with is quite large so I just included a sample section of it. Let me know if you can can get it to work.
    Attached Files Attached Files

  8. #8
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: Need help with macro for converting data

    Give this modified code a try

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    09-12-2012
    Location
    Michigan
    MS-Off Ver
    Excel 2007
    Posts
    127

    Re: Need help with macro for converting data

    Mike,


    That code works. How can I modify to have the output on another tab so the source data remains intact?

  10. #10
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: Need help with macro for converting data

    Here you go

    Please Login or Register  to view this content.
    Last edited by mike7952; 12-31-2012 at 10:50 AM.

  11. #11
    Forum Contributor
    Join Date
    09-12-2012
    Location
    Michigan
    MS-Off Ver
    Excel 2007
    Posts
    127

    Re: Need help with macro for converting data

    Works perfect. Problem solved.

    Thanks for all your help...

  12. #12
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Need help with macro for converting data

    Quote Originally Posted by s4driver View Post
    Thanks for getting back to me. I did replace the tab in the the macro and there's not a blank row first. The file I'm working with is quite large so I just included a sample section of it. Let me know if you can can get it to work.
    Here's another:

    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