+ Reply to Thread
Results 1 to 7 of 7

Splitting cell contents

  1. #1
    Registered User
    Join Date
    06-19-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    23

    Splitting cell contents

    Hi there,

    I need some help in splitting the contents of a cell into multiple cells. For example,

    From -> To
    24678736 -> 24 46 67 78 87 36
    4375 -> 43 37 75

    the length of the targeted cell is not fix.
    Is there a script that can do that?

    Thanks.

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: Splitting cell contents

    Do you always want them in pairs of two? Do the values always have an even number of digits? If not, if the number of digits is uneven, how do you want to split?

    1 23 45

    or

    12 34 5

    ??

  3. #3
    Forum Expert ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2010
    Posts
    2,952

    Re: Splitting cell contents

    Here's one approach:

    Please Login or Register  to view this content.
    Autofill to the right.

    Cheers,
    Last edited by ConneXionLost; 01-12-2010 at 04:08 AM.
    Would you like to say thanks? Please click the: " Add Reputation" button, on the grey bar below the post.

  4. #4
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Splitting cell contents

    Hi novodisc
    Why not a UDF

    PHP Code: 
    Function SplitInt(test)as string
    Dim i
    !,e$
    For 
    1 To Len(testStep 2
    " " Mid(test,  i2)
    Next
    SplitInt 
    e
    End 
    Function 
    Last edited by pike; 01-12-2010 at 04:17 PM.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  5. #5
    Registered User
    Join Date
    06-19-2009
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Splitting cell contents

    Thanks a lot guys! All methods worked!
    apperciate your help!

  6. #6
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Splitting cell contents

    novodisc --- dont forget

    To mark your thread solved do the following:
    - Go to the first post
    - Click edit
    - Click Advance
    - Just below the word "Title:" you will see a dropdown with the word No prefix.
    - Change to Solve
    - Click Save

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

    Re: Splitting cell contents

    novodisc,

    Try:


    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

    Adding the Macro
    1. Copy the below macro, by highlighting the macro code and pressing the keys CTRL + C
    2. Open your workbook
    3. Press the keys ALT + F11 to open the Visual Basic Editor
    4. Press the keys ALT + I to activate the Insert menu
    5. Press M to insert a Standard Module
    6. Paste the code by pressing the keys CTRL + V
    7. Press the keys ALT + Q to exit the Editor, and return to Excel
    8. To run the macro from Excel, open the workbook, and press ALT + F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.


    Please Login or Register  to view this content.
    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.

+ 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