Announcement

Collapse
No announcement yet.

Search For The Character ? Not Wildcard

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Search For The Character ? Not Wildcard



    I need to get rid of the questions marks in the text on my sheet, but am unable to get my VBA code to search for an actual question mark and not the wildcard. I'm using the replace function as follows:

    Code:
    wsReport.Cells = wsReport.Cells.Replace("?", "")
    1. What's the trick to searching for wildcard characters?
    2. Is there a slicker way to do this?

    Thanks in advance.

  • #2
    Re: Search For The Character ? Not Wildcard

    Untested but to search for question marks I think you use ~?

    Comment


    • #3
      Re: Search For The Character ? Not Wildcard

      Use "substitute", it works
      Code:
      Sub sdsdsd()
          Cells(1, 1) = Application.WorksheetFunction.Substitute(Cells(1, 1), "?", "qqq")
      End Sub

      Comment


      • #4


        Re: Search For The Character ? Not Wildcard

        Originally posted by StephenR
        Untested but to search for question marks I think you use ~?
        Thanks Stephen.

        Code:
        wsReport.Cells.Replace "~?", ""
        This works perfectly.

        Comment

        Working...
        X