VBA10進16進+gb2312表

10進数を16進数に変換
Function Dec2Hex(Dec As Long) As String
Dec2Hex = Hex(Dec)
End Function

16進数を10進数に変換
Function Hex2Dec(Hex As String) As Long
Hex2Dec = Val("&H" & Hex)
End Function

16進数表示による演算の例
Sub TestHex()
MsgBox Hex(&Ha + &Hd)
End Sub

Sub chrAndChrW()

Dim iLoop As Integer
Application.ScreenUpdating = False

For iLoop = 1 To 9999
Cells(iLoop, 1) = CStr(iLoop)
Cells(iLoop, 2) = CStr(Hex(iLoop))
Cells(iLoop, 3) = Chr(iLoop)
Cells(iLoop, 4) = ChrW(iLoop)

If Cells(iLoop, 3) = Cells(iLoop, 4) Then
Cells(iLoop, 5) = "○"
Else
Cells(iLoop, 5) = "×"
End If
Next iLoop
Application.ScreenUpdating = True
Application.StatusBar = False
Cells(1, 1).Select

End Sub

http://www.chi2ko.com/tool/CJK.htm
http://www.kishugiken.co.jp/cn/code09c.html

0 コメント: