Public Sub MySplit(ByVal Num As Variant, ByRef Last As String, ByRef Another As String)
sNm = Hex$(Num)
Last = "&H" + Right(sNm,1)
If Len(sNm)>3 then
Another = Left(sNm, Len(sNm)-1)
End If
End Sub
MySplit &H123ABC7, a$, b$
MsgBox a$ 'Сообщит "&H7"
MsgBox b$ 'Сообщит "&H123ABC"
Option Explicit
Private Sub Form_Load()
Dim Val1 As Long, Val2 As Long, Val3 As Long, tmstr As String
Val1 = &H2710 ' òâî¸ ÷èñëî
tmstr = Hex(Val1)
Val2 = Val("&H" & Right(tmstr, 1))
Val3 = Val("&H" & Left(tmstr, Len(tmstr) - 1))
MsgBox Hex(Val2)
MsgBox Hex(Val3)
End Sub
keks-n писал(а):А можно и так:
- Код: Выделить всё
Option Explicit
Private Sub Form_Load()
Dim Val1 As Long, Val2 As Long, Val3 As Long, tmstr As String
Val1 = &H2710 ' òâî¸ ÷èñëî
tmstr = Hex(Val1)
Val2 = Val("&H" & Right(tmstr, 1))
Val3 = Val("&H" & Left(tmstr, Len(tmstr) - 1)) '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
MsgBox Hex(Val2)
MsgBox Hex(Val3)
End Sub
Сейчас этот форум просматривают: AhrefsBot и гости: 195