Excel Workbook | ||||
---|---|---|---|---|
A | B | |||
1 | a | 97 | ||
2 | 97 | a | ||
1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
B1 | =CODE(A1) | |
B2 | =CHAR(A2) |
Does such function exist in Excel?
Function CodeUni(s As String, Optional bHex As Boolean = True) As Long
CodeUni = IIf(bHex, Hex(AscW(Left(s, 1))), AscW(Left(s, 1)))
End Function
Function CodeUni(s As String, Optional bHex As Boolean = True)
If bHex Then
CodeUni = Right("0000" & Hex(AscW(Left(s, 1))), 4)
Else
CodeUni = AscW(Left(s, 1))
End If
End Function
Function CharUni(sCode As String, Optional bHex As Boolean = True) As String
If bHex Then CharUni = ChrW("&H" & sCode) Else CharUni = ChrW(sCode)
End Function