+ Reply to Thread
Results 1 to 8 of 8

Splitting cell contents by lines (2)

  1. #1
    Forum Contributor
    Join Date
    06-12-2006
    Location
    Portugal
    MS-Off Ver
    Microsoft 365 Apps for enterprise
    Posts
    212

    Splitting cell contents by lines (2)

    Hello to all,

    Yesterday I had an excellent help from “nilem” forum expert on post “Splitting cell contents by lines”, which I’m transcripting:
    Column B contains many lines of numbers, as per the following example:
    Line1 111222/145251
    Line2 333115
    Line3 777555/154154
    Line4 888999/115116
    Line5 110110
    Line6 110115
    Line7 620260/145521

    So numbers are always 6 digits long, sometimes separated by "/". I need to pass all data to columd D, in sets of 6 digits. In the present case all need to obtain 11 lines of all sets of 6 digits, without the slash.

    The solution that nilem gave me works fine on a single worksheet, however, I needed to modify it because the destination cells are on a different worksheet. On this little bit modified code on line:
    Please Login or Register  to view this content.
    i’m getting the error: “Application-defined or object-defined error”
    Can someone please give me some help to solve this?
    Many thanks in advance
    Here’s the code:
    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Splitting cell contents by lines (2)

    Hello,

    Try this code :
    (make sure to change the source / destination cell if required)

    Please Login or Register  to view this content.
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

  3. #3
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Splitting cell contents by lines (2)

    If you can post a sheet post it, but you say your data is in column B, but your code is:

    Please Login or Register  to view this content.
    This is where the code is looking for the data from. So if you data is in column B change the D2 to B and whatever row your data starts on. There might be other problems but I'm not good enough to figure that part out without an actual worksheet. Double check your sheet names are spelled right and also that there is not a space after the sheet name. Sometimes when you look at the tab you don't know there's a space after the name unless you choose to rename the tab and then you will notice a space between your cursor and the last character in the sheet name.
    Last edited by skywriter; 05-22-2015 at 01:07 PM.
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  4. #4
    Forum Contributor
    Join Date
    06-12-2006
    Location
    Portugal
    MS-Off Ver
    Microsoft 365 Apps for enterprise
    Posts
    212

    Re: Splitting cell contents by lines (2)

    Hi GC.
    Unfortunately, it produces the same error. Please note that source of date has to be "D2".
    Thanks
    Octavio

  5. #5
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Splitting cell contents by lines (2)

    Quote Originally Posted by oteixeira View Post
    Hi GC.
    Unfortunately, it produces the same error. Please note that source of date has to be "D2".
    Thanks
    Octavio
    So this is a typo?
    Column B contains many lines of numbers
    If your numbers are in column D, then change the 2 after the word "Count" in the code to a 4 so it looks like this.

    Please Login or Register  to view this content.
    Last edited by skywriter; 05-22-2015 at 01:19 PM.

  6. #6
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: Splitting cell contents by lines (2)

    Unfortunately, it produces the same error. Please note that source of date has to be "D2".
    As I wrote in my answer : (make sure to change the source / destination cell if required)

    Probably that skywriter suggestions will work, if not please post your file.
    Thanks,

  7. #7
    Forum Contributor
    Join Date
    06-12-2006
    Location
    Portugal
    MS-Off Ver
    Microsoft 365 Apps for enterprise
    Posts
    212

    Re: Splitting cell contents by lines (2)

    Skywriter, thanks a lot. It worked perfectly. Many kudos to you.
    Octavio

  8. #8
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Splitting cell contents by lines (2)

    Thanks for the rep. points and the feedback.

    Please mark this thread as solved.

    Click the Thread Tools drop down box above your first post and choose solved.

+ 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] Splitting cell contents by lines
    By oteixeira in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-21-2015, 12:37 PM
  2. splitting multile lines in one cell into columns
    By m4rty5miff in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-11-2012, 08:53 AM
  3. splitting multiple lines in one cell into columns
    By m4rty5miff in forum Excel General
    Replies: 1
    Last Post: 02-10-2012, 12:15 PM
  4. Splitting cell contents
    By Jeshen in forum Excel General
    Replies: 6
    Last Post: 12-20-2011, 12:39 PM
  5. Splitting the contents of a cell
    By sheargraphix in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-14-2011, 07:11 AM

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