View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Eliminate wild characters

Give this function a try...

Function WildcardsToSpaces(ByVal S As String) As String
Dim X As Long
Const Wildcards As String = "~!@#$%^&*()"
For X = 1 To Len(Wildcards)
S = Replace(S, Mid(Wildcards, X, 1), " ")
Next
WildcardsToSpaces = S
End Function

--
Rick (MVP - Excel)


"MrRJ" wrote in message
...
Hi,
Is there a VBA code to eliminate wild characters ~!@#$%^&*() and replacing
them with a space?
I found this on this site and looks like it could work but need to
incoporate the wild characters and in a specific column.

Function RemAlpha(str As String) As String
With CreateObject("VbScript.RegExp")
.Global = True
.IgnoreCase = True
.Pattern = "[A-Z]"
RemAlpha = .Replace(str, vbNullString)
End With
End Function

I appreciate any help you can give.