+ Reply to Thread
Results 1 to 8 of 8

Marco to delete characters in a cell

  1. #1
    Registered User
    Join Date
    12-31-2020
    Location
    Belgium
    MS-Off Ver
    Office 2019 & 365
    Posts
    1

    Marco to delete characters in a cell

    Hello,

    First at all, excuse-me for my terrible English.

    I have a table which is the output of another program. In the cells ( in the same column) which contain the date and time of registration are too many characters. It's mention also the milliseconds and timezone and they disturb the import in an other program. I want to write a macro that erases the last 10 characters in that cell.

    For example: 2020-12-31T17.30.20.10+01.00h must become 2020-12-31T17.30.20

    It would be graet that also the T disappeared.

    And at last, if there is a code that can do that. It is possible to do it on many cells in one time? One cell a time is great, the hole column in one time would be excellent.

    Thank you all.

    Sigpro

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Marco to delete characters in a cell

    Assuming your data is in column A, place this formula in column B and copy it down the column: =LEFT(A1,LEN(A1)-10)
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,529

    Re: Marco to delete characters in a cell

    Please Login or Register  to view this content.
    Result is also in Column B

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,529

    Re: Marco to delete characters in a cell

    If you want to keep it in the same Column.
    Please Login or Register  to view this content.

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Marco to delete characters in a cell

    Assumes data starts in A1
    Please Login or Register  to view this content.
    Last edited by sintek; 12-31-2020 at 03:31 PM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  6. #6
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,529

    Re: Marco to delete characters in a cell

    The New Years Celebrations played a roll here. I gave you suggestions you did not ask for. You want the time also!
    Do you want a separating character between date and time?

  7. #7
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,529

    Re: Marco to delete characters in a cell

    Please Login or Register  to view this content.
    Change this
    Please Login or Register  to view this content.
    to this
    Please Login or Register  to view this content.
    if you want a space between the date and time

    Or direct in Column A
    Please Login or Register  to view this content.
    Change this
    Please Login or Register  to view this content.
    to this
    Please Login or Register  to view this content.
    if you want a space between the date and time

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,526

    Re: Marco to delete characters in a cell

    Quote Originally Posted by sigpro View Post
    For example: 2020-12-31T17.30.20.10+01.00h must become 2020-12-31T17.30.20

    It would be graet that also the T disappeared.
    Assuming the data in Col.A
    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. [SOLVED] Delete all characters in the cell except the first 5
    By roskalov in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-05-2017, 04:44 AM
  2. I need marco script that will delete cell if it contains "Free preview" in column E
    By Rabbitstew in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-27-2013, 01:20 AM
  3. how to delete first 4 characters in a cell?
    By sami770 in forum Excel General
    Replies: 12
    Last Post: 05-29-2011, 07:01 AM
  4. Delete last 9 characters from a cell
    By Tom K in forum Excel General
    Replies: 1
    Last Post: 03-05-2008, 02:10 PM
  5. delete certain characters from a cell
    By legolas in forum Excel General
    Replies: 4
    Last Post: 09-19-2007, 04:20 AM
  6. [SOLVED] Delete first few cell characters
    By mohd21uk via OfficeKB.com in forum Excel General
    Replies: 4
    Last Post: 06-07-2006, 07:35 AM
  7. Replies: 2
    Last Post: 06-07-2006, 07:10 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