+ Reply to Thread
Results 1 to 10 of 10

Tough Loop

  1. #1
    Registered User
    Join Date
    09-25-2012
    Location
    Illinois
    MS-Off Ver
    Excel 2003
    Posts
    8

    Tough Loop

    So i'm almost done with my Macro, but I just can't figure out the final loop to make it work.

    My data comes in like such:

    6059
    0122
    1200
    4032
    6059

    6059
    6301
    6316
    6059

    All in one column, and one number per row.
    The 6059's are always before and after the data that I need, so the loop needs to scroll the entire row and extract the #'s from each row, and use the 6059's like a delimeter. It should fomat the data and move the value to a different row as such (discluding the 6059's), One grouping of #'s per row:
    122 1200 4032
    6301 6316

    Any help?

  2. #2
    Registered User
    Join Date
    09-25-2012
    Location
    Illinois
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Tough Loop

    Oh and for some reason the #'s in this row all come in with a single quote before them, and the only way i've found that I can use .Find is to manually select them all, click the exclamation mark and convert to number. Is there a way to automatically do this in the macro?

  3. #3
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Tough Loop

    hi neghsmoke can you post a sample file with original data and a result you need to obtain?

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: Tough Loop

    Something like this, assuming input data in column A and output in column B

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  5. #5
    Registered User
    Join Date
    09-25-2012
    Location
    Illinois
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Tough Loop

    MacroProject.xlsx
    Andy, I will give it a try when I get to work thanks
    watersev, attached is the example file
    Last edited by neghsmoke; 09-25-2012 at 08:49 AM.

  6. #6
    Registered User
    Join Date
    09-25-2012
    Location
    Illinois
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Tough Loop

    If I'm understanding your code properly, that would return the #'s between the 6059's each on a new row? How would you group each result group in one cell seperated by a space?

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: Tough Loop

    Try this mod for your example file and single cell output.

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    09-25-2012
    Location
    Illinois
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Tough Loop

    Sweet, thanks again Andy

  9. #9
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Tough Loop

    option:

    Please Login or Register  to view this content.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    09-25-2012
    Location
    Illinois
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Tough Loop

    Tried Andy's second script today and it worked like a charm. I will try yours out tommorow watersev and try to piece together how it works. Thanks to you both.

+ 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