Replace Umlat character in VBA

vavs

Well-known Member
Joined
Jul 2, 2004
Messages
514
I have a worksheet that I am running a macro on where they insist on having ~N/A~ in certain cells. I am copying cells from this worksheet and I don't want to import these values into the new worksheet. I want to replace this value with a blank cell. When I use the replace value
VBA Code:
    Selection.Replace What:="~N/A~", Replacement:="", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
I only replace the N/A and not ~N/A~. How do I indicate that the ~ needs to be replaced as well?
 

Some videos you may like

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,251
Office Version
  1. 365
Platform
  1. Windows
You need to escape the tilde like
VBA Code:
"~~N/A~~"
 

Watch MrExcel Video

Forum statistics

Threads
1,126,982
Messages
5,621,964
Members
415,869
Latest member
LWSkinner

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top