Can I insert a symbol in VBA?

E

Ed Landau

In spreadsheet mode, I can insert a symbol (Insert -> Symbol). I chose
Unicode 06DE (hex).
Can I get VBA to put this "symbol" into a cell (Range("A1") for example) ?

Thanks
-Ed
 
B

Bernie Deitrick

Ed,

Try recording a macro while you do it, then edit the resulting code.

HTH,
Bernie
MS Excel MVP
 
E

Ed Landau

I've tried that :). Replaying the macro puts a question mark ("?") in the
cell I put a symbol in when I recorded the macro!

-Ed
 
B

Bernie Deitrick

Ed,

Try something like this, which requires a reference the the ATPVBAEN:

Sub EdInsertSymbol()
With ActiveCell
.Value = ChrW(Hex2Dec("06DE"))
With .Characters(Start:=1, Length:=1).Font
.Name = "Kristen ITC" 'Use the correct font name here
End With
End With
End Sub

HTH,
Bernie
MS Excel MVP
 
M

Myrna Larson

Just a comment: No need for Hex2Dec. VBA "understands" hex literals. You enter
them with the &H prefix, i.e.

.Value = ChrW(&H06DE)
 
E

Ed Landau

THANK YOU THANK YOU THANK YOU .....

I've been looking all over the web. No information on inserting unicode or
symbols. I have three books and none talk about it. THANK YOU SO MUCH.
YOU MADE MY WEEK :)

-Ed
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top