View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Zoltan Zoltan is offline
external usenet poster
 
Posts: 25
Default Find and replace "?" character

Thanks for the helps. You solved my problem. Tilde works.

Zoltan

"Vergel Adriano" wrote:

Put a tilde (~) character before the ?. You can also don't need to loop.

Range("h98:i100").Replace What:="~?", Replacement:=""


--
Hope that helps.

Vergel Adriano


"Zoltan" wrote:

Hello,

I have an easy question which I could solve so far.
I would like to find all ? character on a worksheet and delete it from each
cells.

My code is:

Private Sub CommandButton2_Click()
Dim rng1 As Range
Dim mycell1 As Range
Set rng1 = Range("h98:i100")
For Each mycell1 In rng1

If Not mycell1.Find("?") Is Nothing Then
mycell1.Replace What:="?", replacement:=""
End If
Next

End Sub


the result is, that it deletes each character, not just the ?s. My idea is,
that this is because ? is a special character to be used to look for
something which is not known in an expression.

How can I replace my ?s ? And onyl the ?s ?

Thanks for your help,
Zoltan