I'm trying to use VBA to replace some formulas in a spreadsheet when the user requests them. One of those should include question mark (?). I know this is a wildcard, but it works within my formula, not in VBA.
I get the error "Compile Error: Expected: End of statement," and my question mark is highlighted.
If I precede question mark with a tilde, like so, I get a slightly different error: "Compile error: Invalid character."
How can I force VBA to think that the ? is a text character and not a wildcard?
Thanks in advance!
VBA Code:
Range("B14").Formula = "=IF($D14<>"","?","")"
I get the error "Compile Error: Expected: End of statement," and my question mark is highlighted.
If I precede question mark with a tilde, like so, I get a slightly different error: "Compile error: Invalid character."
VBA Code:
Range("B14").Formula = "=IF($D14<>"","~?","")"
How can I force VBA to think that the ? is a text character and not a wildcard?
Thanks in advance!