+ Reply to Thread
Results 1 to 5 of 5

Split cell contents over multiple rows based on cell contents

  1. #1
    Registered User
    Join Date
    04-12-2010
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    11

    Split cell contents over multiple rows based on cell contents

    Hi All,

    I have my code for the most part working but unfortunately it duplicates and misses some data. I have tried to find the issue but I just can't see it and thought having some fresh eyes looking at it may be able to sort it out. Basically the source data is the orders which were sent on a particular delivery docket. The letters are not important so I have that data stripped out. I then were there were multiple orders on a line such as KC224601-12 needs to become 224601 and on the next line 224612.


    Below is some sample data along with the results it gives me along with my desired results. This has not formatted properly but is also visible on the second sheet of the attached file.
    HTML Code: 
    I have attached my spreadsheet for looking over. The part which I think is causing the error is in the code snip below which is the section which looks after the multiple orders section. This is just a snippet of the whole macro.

    Please Login or Register  to view this content.
    Any assistance or advice people can give would be much appreciated as it is starting to drive me nuts and I know it is probably a really simple thing I am missing.
    Last edited by naigy; 01-17-2011 at 05:39 PM.

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

    Re: Split cell contents over multiple rows based on cell contents

    hi, I would suggest to do that a bit differently, press "Start" on Sheet "Source"
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    04-12-2010
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Split cell contents over multiple rows based on cell contents

    Hi Watersev,

    You have sure condensed by code to a very short process which for the most part looks like it has worked well however there is one issue with it.

    Please Login or Register  to view this content.
    I think this is due to it somehow always referring to the first order. What the code needs to do is refer to the order before the current one and just change the last x number of characters (where x is the number of numbers before the next "-" or the end of the line).

    As I don't follow your code as it is using functions I haven't used before in Excel or Access vba would appreciate your assistance to sort this.


    Thanks for your prompt reply and assistance.

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

    Re: Split cell contents over multiple rows based on cell contents

    I see your point, see attachment
    Attached Files Attached Files
    Last edited by watersev; 01-16-2011 at 04:03 PM.

  5. #5
    Registered User
    Join Date
    04-12-2010
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Split cell contents over multiple rows based on cell contents

    Sweet. I think that has sorted it. I have modified the code a little to try and adapt it into the rest of the worksheet and so far so good. Will post back if I have any further issues.

    The way you have coded this is really interesting and I look forward to steping through it in close detail so i can understand exactly how this works as i would really like to improve my abilities in this area.

+ 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