Results 1 to 13 of 13

Replace Leading Apostrophes

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    4,065

    Replace Leading Apostrophes

    I have a macro that's not doing all it's supposed to be doing.
    What it's supposed to do is remove all leading apostrophes.
    What it's doing is removing leading apostrophes from numbers, so '507 becomes 507, what I want.
    What it's NOT doing is removing leading apostrophes from text, so 'Doc becomes Doc, which I also want.

    What do I have wrong?

    Sub ApostropheKiller()
        'Kills leading apostrophes
        Dim s As Range
        If MsgBox("Want to remove all leading apostrophes from your selection?", _
        vbOKCancel + vbQuestion, "Are you sure you?") = vbCancel Then Exit Sub
       
        For Each s In Selection
                s.Value = Replace(s.Value, "'", "")
        Next s
     
    End Sub
    Attached Files Attached Files
    I know I'm not stupid, but I suspect I'm a lot stupider than I think I am

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How to keep leading zeros when using find and replace
    By scottwiebe in forum Excel General
    Replies: 5
    Last Post: 11-15-2018, 04:01 PM
  2. [SOLVED] Trying to get rid of leading apostrophes in text cells
    By Habanero Time in forum Excel General
    Replies: 13
    Last Post: 12-29-2017, 08:12 PM
  3. Replies: 14
    Last Post: 09-26-2017, 02:05 PM
  4. Replies: 2
    Last Post: 02-09-2015, 12:32 PM
  5. Only one computer adding leading apostrophes to drop downs
    By dwayne2712 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-22-2012, 11:47 AM
  6. Replace leading zeros
    By brandnewday10 in forum Excel General
    Replies: 6
    Last Post: 09-01-2010, 10:14 AM
  7. [SOLVED] How do I remove leading apostrophes in Excel?
    By Nino in forum Excel General
    Replies: 8
    Last Post: 12-13-2005, 08:20 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