+ Reply to Thread
Results 1 to 8 of 8

VBA Find & Replace apostrophy issue

  1. #1
    Forum Contributor
    Join Date
    02-13-2016
    Location
    MUMBAI
    MS-Off Ver
    Microsoft 365
    Posts
    180

    VBA Find & Replace apostrophy issue

    Hii ..

    I have a issue with this code..

    Please Login or Register  to view this content.
    When I run this code

    '07/17-18'
    '08/17-18'
    '09/17-18'
    '10/17-18'

    gets converted to

    17/07/2018
    17/08/2018
    17/09/2018
    17/10/2018

    but when I manually replace apostrophe with blank using find & replace (Ctrl+H) it works fine..

    PFA
    The issue cells are highlighted in yellow colour..

    help me to resolve the issue!!

    Thank you!!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: VBA Find & Replace apostrophy issue

    Try to format the column A as Custom >> Text before you run the code
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  3. #3
    Forum Contributor
    Join Date
    02-13-2016
    Location
    MUMBAI
    MS-Off Ver
    Microsoft 365
    Posts
    180

    Re: VBA Find & Replace apostrophy issue

    I tried converting to text & run the code but that also didn't work for me..

  4. #4
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: VBA Find & Replace apostrophy issue

    Hi,
    may try this?

    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: VBA Find & Replace apostrophy issue

    Try this code
    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi ! Try these …


    As / - characters are often the date separators …

    PHP Code: 
    Sub Demo1()
            
    Dim VR&
        
    With ActiveSheet.UsedRange.Columns(1)
                
    Evaluate("IF({1},SUBSTITUTE(" & .Address ",""'"",""""))")
            For 
    1 To UBound(V)
                If 
    IsDate(V(R1)) Then V(R1) = "'" V(R1)
            
    Next
               
    .Value2 V
        End With
    End Sub 

    A variation :

    PHP Code: 
    Sub Demo2()
            
    Dim VR&
        
    With ActiveSheet.UsedRange.Columns(1)
                
    Evaluate("IF({1},SUBSTITUTE(" & .Address ",""'"",""""))")
            For 
    1 To UBound(V)
                If 
    IsDate(V(R1)) Then Cells(R1).NumberFormat "@"
            
    Next
               
    .Value2 V
        End With
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !
    Last edited by Marc L; 08-01-2019 at 07:40 AM.

  7. #7
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Lightbulb This is the one if …


    Next demonstration well works on my side with Windows regional settings like DD/MM/YYYY
    and under a local Excel version (not UK or US) :

    PHP Code: 
    Sub Demo()
        
    With ActiveSheet.UsedRange.Columns(1)
            .
    FormulaLocal Evaluate("IF({1},SUBSTITUTE(" & .Address ",""'"",""""))")
        
    End With
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !

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

    Re: VBA Find & Replace apostrophy issue

    Try
    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. find and replace issue
    By jen0dorf in forum Excel General
    Replies: 4
    Last Post: 08-03-2016, 07:48 AM
  2. Find and Replace Issue
    By joshuarobbins in forum Excel General
    Replies: 21
    Last Post: 12-23-2015, 06:26 PM
  3. [SOLVED] Issue with FIND/REPLACE Excel 2003 VBA
    By dawatcher in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-17-2013, 06:44 PM
  4. find in excel replace in word: find/replace text in text boxes and headers
    By dean.rogers in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-10-2012, 12:40 PM
  5. Excel 2007 : 2007 Find and Replace Issue
    By jeremy3 in forum Excel General
    Replies: 3
    Last Post: 02-24-2009, 08:28 PM
  6. [SOLVED] Apostrophy Detection
    By Gary's Student in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-24-2005, 10:05 AM
  7. Excel find and replace issue
    By buddyorliz in forum Excel General
    Replies: 3
    Last Post: 06-04-2005, 05:05 PM

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