+ Reply to Thread
Results 1 to 7 of 7

[Urgent] Cut a sentence with max 40 char

  1. #1
    Registered User
    Join Date
    11-30-2014
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    3

    [Urgent] Cut a sentence with max 40 char

    Hello,

    I need urgent help here and thank you for viewing and probably assist me in my Excel VBA problem.

    Basically I have a database of sentences within the same cell that:
    1)needs to be cut with max of 40 characters (without distorting the words on the 40th character)
    2)Slot them back into the next few rows depending on how many characters (most no. of char I have up till now is 120 within the same cell)
    3) rename the line number to reflect the latest changes
    4) Re-do the same steps for all the lines and reflect the correct Process no. and Line no.

    All these are shown below:

    Before:
    Capture.JPG

    After:
    Capture2.JPG


    Can someone create the Excel VBA code to automate these changes?

    Thank you so much for your help!
    Last edited by dotchin; 11-30-2014 at 01:48 PM.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: [Urgent] Cut a sentence with max 40 char

    why did you post a picture?

    why not post the spreadsheet?

    Few people will want to help you, without your data.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,409

    Re: [Urgent] Cut a sentence with max 40 char

    I read this too quickly... Here is a formula-based approach instead. Will this do? It is set up for use with the source text in A1. Copy down as needed.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    See random text example (or is it Klingon??) in the attached sheet
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: [Urgent] Cut a sentence with max 40 char

    Try this macro.

    It assumes you want the output on sheet2

    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: [Urgent] Cut a sentence with max 40 char

    Try this macro.

    It assumes you want the output on sheet2

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

  6. #6
    Registered User
    Join Date
    11-30-2014
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    3

    Re: [Urgent] Cut a sentence with max 40 char

    Quote Originally Posted by mehmetcik View Post
    Try this macro.

    It assumes you want the output on sheet2

    Please Login or Register  to view this content.
    yup it works! thank you so much!!!

  7. #7
    Registered User
    Join Date
    11-30-2014
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    3

    Re: [Urgent] Cut a sentence with max 40 char

    thanks Glenn for your help too!!

+ 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. Replies: 12
    Last Post: 04-08-2014, 08:12 PM
  2. [URGENT][Help with a VBA Macro - Maximum with criterias][URGENT]
    By mahmoudmerhi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-04-2013, 03:39 PM
  3. [SOLVED] Function to take text from x:th char to next n char
    By Temporary-Failure in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-07-2013, 02:19 AM
  4. Changing a single Char in a string to another ASCII char
    By goofy78270 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-15-2007, 09:45 AM
  5. Replies: 6
    Last Post: 03-10-2006, 01:15 PM

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