+ Reply to Thread
Results 1 to 5 of 5

Macro to delete first nine characters in a cell for a row of data.

Hybrid View

  1. #1
    Registered User
    Join Date
    02-11-2013
    Location
    Centennial, CO
    MS-Off Ver
    Excel 2010
    Posts
    2

    Macro to delete first nine characters in a cell for a row of data.

    Example:
    I have imported a list of email addresses (6000 rows). The data in each cell looks like this:

    email address:[email protected].

    I need a macro to delete "email address:_" in each cell (_ being a space).

    I tried the macro recorder and cannot get it to work. HELP!

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

    Re: Macro to delete first nine characters in a cell for a row of data.

    In which column/s is/are the data to be deleted? I think it would be easier for testing if you could attach a sample book.

  3. #3
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Macro to delete first nine characters in a cell for a row of data.

    email address:_

    is more than 9 characters.
    Gary's Student

  4. #4
    Registered User
    Join Date
    02-11-2013
    Location
    Centennial, CO
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Macro to delete first nine characters in a cell for a row of data.

    I have several different columns with different numbers of characters to delete. I am guessing that i can use the same macro for each column and just change the number of characters to delete. So in the example given, it would be 15.

  5. #5
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Macro to delete first nine characters in a cell for a row of data.

    Select the cells you want to fix and run:

    Sub AdFixer()
    Dim r As Range, V As String, L As Long
    For Each r In Selection
        V = r.Value
        L = InStr(V, ":")
        If L <> 0 Then
            r.Value = Mid(V, L + 2, 9999)
        End If
    Next
    End Sub

+ 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