Reputation: 147
I would like to insert a symbol with VBA. The following works well:
Sub testver()
Sheets("mapping").Cells(1, 10) = ChrW(&H634)
end sub
.. but now I would like to make the character code variable. It gets the number from a mapping table. I simplified the code and excluded the mapping part as that is not important for my question. But I get an error if I use 'codec' in the ChrW part. Codec should be 634. Anyone knows how to write this part of the vba code correctly?
Sub testver2()
codec = Sheets("mapping").Cells(11, 1)
Sheets("mapping").Cells(1, 10) = ChrW(&H"codec")
end sub
Thanks in advance! Amir
Upvotes: 1
Views: 5988
Reputation: 2623
This should work:
Sub testver2()
codec = Sheets("mapping").Cells(11, 1)
Sheets("mapping").Cells(1, 10) = ChrW("&H" & codec)
End Sub
Upvotes: 1