+ Reply to Thread
Results 1 to 8 of 8

A macro for removing characters after a specific number of character

  1. #1
    Registered User
    Join Date
    01-12-2016
    Location
    Europe
    MS-Off Ver
    MS 2013
    Posts
    48

    A macro for removing characters after a specific number of character

    Hi Forum,

    I am seeking to create a macro that is able to delete all the remaining characters after the 10th character in each cell. So I wish to only have the first date listed in each cell, and hence delete all the remaining dates.

    I know this is manageable when using regular excel-build in functions. But I would really like to see how it is done in VBA. Any ideas how that would look like?

    Br
    vba problem.xlsm

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: A macro for removing characters after a specific number of character

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,474

    Re: A macro for removing characters after a specific number of character

    One way:

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: A macro for removing characters after a specific number of character

    Another way using Reg-exp

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-12-2016
    Location
    Europe
    MS-Off Ver
    MS 2013
    Posts
    48

    Re: A macro for removing characters after a specific number of character

    Thank you all. Everyone was very useful!

    Appreciate it!

  6. #6
    Registered User
    Join Date
    01-12-2016
    Location
    Europe
    MS-Off Ver
    MS 2013
    Posts
    48

    Re: A macro for removing characters after a specific number of character

    TMS, thank you for your reply. I was wondering if you could briefly elaborate with your words on what you are doing?

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,474

    Re: A macro for removing characters after a specific number of character

    You're welcome. Thanks for the rep.


    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,474

    Re: A macro for removing characters after a specific number of character

    Of course ...

    The reason for using an array is that it will be quicker to loop through data in memory than processing individual cells in a loop.

    Please Login or Register  to view this content.

+ 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. Removing Characters from Right Until Certain Character
    By jam_ran in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-13-2016, 12:19 PM
  2. [SOLVED] removing specific beginning characters within all cells
    By tdf2437 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-22-2014, 02:45 PM
  3. [SOLVED] formula to count number of characters after a specified character
    By buddigars in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 09-19-2014, 04:31 PM
  4. [SOLVED] Removing Specific Characters using IF(ISNUMBER(SERACH....
    By rpc06 in forum Excel General
    Replies: 7
    Last Post: 09-17-2014, 08:59 AM
  5. [SOLVED] How to replace all characters before a specific character
    By allsystems in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-08-2013, 08:40 AM
  6. [SOLVED] Removing the first 6 character of the id number
    By jamesjessie117 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-17-2012, 05:17 PM
  7. Removing user-specific characters from data
    By Bonnister in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-05-2012, 12:05 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