+ Reply to Thread
Results 1 to 3 of 3

Remove Part of text string

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-20-2007
    MS-Off Ver
    2003 & 2007
    Posts
    299

    Remove Part of text string

    I need a macro to remove the period at the end of my text string in Range O5:down. I have other periods in the text string that need to remain. Only remove the last one. Is this possible?

    thank you.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe

    Sub RemovePeriod()
    Dim Lr As Long
    Dim c As Range, Rng As Range
    Lr = Cells(Rows.Count, "O").End(xlUp).Row
    Set Rng = Range("O5:O" & Lr).SpecialCells(xlCellTypeConstants, 2)
    For Each c In Rng
        If Right(c, 1) = "." Then
            c.Value = Mid(c, 1, Len(c) - 1)
        End If
    Next c
    End Sub
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Contributor
    Join Date
    02-20-2007
    MS-Off Ver
    2003 & 2007
    Posts
    299
    Awesome!! it's perfect.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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