user3619429
user3619429

Reputation: 17

How do I assign a cell formula containing symbols using VBA?

I’m using VBA and I have to insert this formula =SE($w2="s"; SE($C2-(+Foglio1!$F2))>0;"▲";"▼"; "";) on the cell in excel’s file, and then run the Macro.

How do I write these symbols ▲ ▼ in the macro such that they show up in the cell's formula?

Upvotes: 1

Views: 1581

Answers (1)

z̫͋
z̫͋

Reputation: 1561

The characters ▲ and ▼ are respectively known as Black up-pointing triangle, and Black down-pointing triangle in Unicode. Their respective code are U+25B2 and U+25BC.

So if you want to use them inside a macro, you need to use the ChrW function like this:

[A1].Formula = "=SE($w2=”s”; SE($C2-(+Foglio1!$F2))>0;""" & ChrW(&H25B2) & """;""" & ChrW(&H25BC) & """; """";)"

Upvotes: 4

Related Questions