OptionExplicit
Private Function TenturnTwo(ByVal varNum As Long)
Dim returnString As String,ModNum As Integer
Do While varNum > 0
ModNum=varNum Mod 2
varNum=varNum\2
returnString=Trim(Str(ModNum))+returnString
Loop
TenturnTwo=returnString
End Function
Private Function TwoturnTen(ByVal varString As String)
Dim SLen As Long,I As Long,returnNum As Long
SLen=Len(varString)
For I =0 To SLen-1
returnNum=returnNum+Val(Mid(varString,I+1,1))*(2^(SLen-I-1))
Next
TwoturnTen=returnNum
End Function
可以的话,也帮我解释下这个的语言
for i=0 to 12
p=m mod 2
if p=1 then
have=have&i&","
end if
m=int(m/2)
if m=0 then
zhuan=have
exit function
end if
next
end function