Private Sub Command1_Click()
Dim s As String, result As String, m As String
Dim t As Integer, k As Integer
s = Text1.Text
result = ""
m = "0123456789ABCDEF"
t = 0
If Len(s) Mod 4 = 0 Then k = 0 Else ①
For i = 1 To Len(s)
r = Mid(s, i, 1)
k = k + 1
If k = 4 Then
result = result + Mid(m, t + 1, 1)
t = 0
②
End If
Next i
Label1.Caption = result
End Sub
① ②