parap
parap

Reputation: 1985

How to Reference Special Characters Using Excel vba

I have several special characters in an excel spreadsheet. How do I reference them in Excel VBA?

The characters I need are not in the standard 255 ASCII codes.

I was thinking perhaps Chr(code) would work, but I'm not able to find the codes for the characters I need to test this.

Upvotes: 3

Views: 6812

Answers (2)

Teodora
Teodora

Reputation: 11

Use this script to see ChrW characters in F column

Sub caracter()
Dim caract As String
Dim r As Range
Dim i As Integer
caract = ChrW(633)
For i = 1 To 20000
caract = ChrW(i)
ActiveSheet.Cells(i, 6).Value = caract
Next i
End Sub

Upvotes: 1

ttaaoossuu
ttaaoossuu

Reputation: 7894

User ChrW() instead of Chr() function to reference Unicode characters:

ChrW(23383) will produce .

Chr(23383) will throw an exception.

Upvotes: 5

Related Questions