Reputation: 1985
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
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
Reputation: 7894
User ChrW()
instead of Chr()
function to reference Unicode characters:
ChrW(23383)
will produce 字
.
Chr(23383)
will throw an exception.
Upvotes: 5