ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to remove " via vba ? (https://www.excelbanter.com/excel-programming/340641-how-remove-via-vba.html)

Ed Dror

How to remove " via vba ?
 
Hi there,

I have a function that remove almost all wildcards

Public Sub Clean()
For Each Cell In Selection

Cell.Value = Replace(Cell.Value, "~", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "@", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "^", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "&", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "*", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "(", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, ")", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "-", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, ",", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, ".", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "/", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "!", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, ";", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "#", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "'", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "?", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, ":", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "'", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "-", " ", 1, 1, vbTextCompare)

Next Cell
End Sub

How to include the " into this function ? ( yes, I can use the ~" with find
and replace manually )

Thanks,

Ed Dror
Email:



Tim Williams

How to remove " via vba ?
 
Cell.Value = Replace(Cell.Value, """", " ", 1, 1, vbTextCompare)

--
Tim Williams
Palo Alto, CA


"Ed Dror" wrote in message
...
Hi there,

I have a function that remove almost all wildcards

Public Sub Clean()
For Each Cell In Selection

Cell.Value = Replace(Cell.Value, "~", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "@", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "^", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "&", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "*", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "(", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, ")", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "-", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, ",", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, ".", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "/", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "!", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, ";", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "#", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "'", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "?", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, ":", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "'", " ", 1, 1, vbTextCompare)
Cell.Value = Replace(Cell.Value, "-", " ", 1, 1, vbTextCompare)

Next Cell
End Sub

How to include the " into this function ? ( yes, I can use the ~" with

find
and replace manually )

Thanks,

Ed Dror
Email:






All times are GMT +1. The time now is 07:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com