Inserting Symbols via a macro

G

GRussell31

Hello,

I need to write a macro that will insert one of the symbols into a cell
via a Macro (specifically the shape called 'Black Circle', which can be
found in the Arial font, in the subset Geometric Shapes).

I have tried recording a macro and doing this to see the code, but when
re-ran it only inserts a question mark.

It displays the character code of 25CF (in unicode), is there anyway I
can use this to insert the character?

Many thanks,

-Graham
 
K

Ken Johnson

Hi Graham,
25CF converted from hexadecimal to double yields 9679.
(2*16^3 + 5*16^2 + 12*16 + 9 = 9679)
Range("A1").Value = ChrW(9679) resulted in a small black circle.
Ken Johnson
 
K

Ken Johnson

Hi Graham,
You're welcome, glad I could help you out. Thanks for the feedback.
Ken Johnson
 
K

Ken Johnson

I know this isn't important, but I just noticed a little mistake I made
in the working out of 25CF to 9679. The final result's correct, but the
+ 9 should have been + 15, since F = 15.
Ken Johnson
 
T

Tom Ogilvy

Here is an easier way:

? &H25CF
9679

so
d# = &H25CF
ActiveCell.value = chrw(d)

or

ActiveCell.Value = chrw(&H25CF)
 
K

Ken Johnson

Hi Tom,
Thanks for that, this is the first time I've worked with Hexadecimal.
It's nice to get to know the little shortcuts.
Ken Johnson
 
G

Guest

Okay, I don't understand how either of you converted that unicode number.
I'd like to convert code 221A to get the checkmark symbol. I'm sure you
could tell me the value, but I'd also like to understand that "easier way"
that Tom mentioned. Where exactly to I enter "? &H221A" to get the result?
Thanks so much!
 
G

GRussell31

Dorci,

To obtain the value enter the macro designer in Excel.
The bring up the immediate window (CTRL + G). You will then be able t
type '? &221a' into the immediate pane and it will return 145.

Hope that helps,

-Graha
 

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