VBA code to enter extended characters onto a worksheet

G

Guest

Can anyone help me with a way to enter extended characters into a worksheet.

I can record myeslf entering something like <<ALT>>+0166 into a cell, but
the recorder shows the actual character, and not the keystroke sequence.

The reason I want to be able to do this is that I want to be able to write a
loop that enters all the characters in a character set into successive cells
in the worksheet thus:

For Counter=1 to 255
selection.formula= (whatever the answer is to this question) e.g.
ALT+0156
selection.offset(1,0).select
Next Counter

then formats them in a particular font, to produce and print character maps
for all characters in that font.

Not life-threatening, I know, but I'm just curious to know how it's done!

Cheers

Pete
 
N

Norman Jones

Hi Peter,

Try:

Sub Tester01()
Dim iCtr As Long
For ictr = 1 To 255
Cells(iCtr, 1) = Chr(iCtr)

Next iCtr

End Sub
 
G

Guest

Nick,

At first glance, it seems to do the same thing - what's the difference
between CHR and CHRW ?

Pete
 
N

NickHK

Peter,
<VBA Help>
.....However, on DBCS systems, the actual range for charcode is -32768 to
65535.

.....The ChrW function returns a String containing the Unicode character
except on platforms where Unicode is not supported, in which case, the
behavior is identical to the Chr function.
</VBA Help>

Change "For ictr = 1 To 255" to something like "For ictr = 1 To 60000" and
see what you get.

Nick
 

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