简体   繁体   中英

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?

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) & """; """";)"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM