Reputation: 345
I'm trying to write in a cell this string "=>". Macro gives "error 1004".
Macro works correctly if I write "=>x" where x stands for another character.
What am I doing wrong?
Thanks
Upvotes: 2
Views: 2651
Reputation: 152585
You can format it as text before entering the value:
With ActiveSheet.Range("A1")
.NumberFormat = "@"
.Value = "=>"
End With
Upvotes: 7
Reputation: 57743
The issue here is that Excel understands =>
as the beginning of a formula because it starts with an equal sign, and you get the error because the formula is incomplete.
If you want to force Excel to understand it as text add a single quote as first character:
Range("A1").Value = "'=>"
Excel will not show the quote '
but it will recognize the cell content as text instead of a formula.
Upvotes: 4