+ Reply to Thread
Results 1 to 2 of 2

Need a macro to search for a character in a cell, then delete all text prior to it.

  1. #1
    Registered User
    Join Date
    12-22-2010
    Location
    Parsippany, NJ
    MS-Off Ver
    Excel 2007
    Posts
    1

    Question Need a macro to search for a character in a cell, then delete all text prior to it.

    I have a spreadsheet with Outlook logs that I need to sort by date. Unfortunately, the entries are text and appear as follows:
    6/28/2010 2:01:30 PM (2010-06-28 18:01:30 UTC)

    I want to be able to delete all the text from the open parenthesis back to the beginning of the cell. Obviously I can do it manually for each cell, but there are about 3000 entries, so that isn't practical.

    Assuming the following can be done, what I'd like to do is create a macro that looks for the open parenthesis, moves the insertion point to the right of it, selects all the text from that point back to the beginning of the cell, and then deletes it.

    That would leave the text so that the year of the entry is first, and I can accurately sort it even if it remains formatted as text.

    Unfortunately, I haven't been able to figure out how to get this done. The search function seems to work only to find a particular cell, not to search and create an insert within a cell. Any help would be greatly appreciated.
    Last edited by lawyerdude666; 06-28-2011 at 10:25 AM. Reason: spelling error

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Need a macro to search for a character in a cell, then delete all text prior to i

    Hi and welcome to the board

    Depending on how your data is organized, you can use Data - Text to Columns and use the open parenthesis as a delimiter. In the last par of the wizard, select not to import the first column

    Eventually record a macro to this effect

+ 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