📄 modvariables.bas
字号:
Attribute VB_Name = "modVariables"
' API functions
Public Declare Function GetTickCount Lib "kernel32.dll" () As Long
Public intImage(3) As Integer
Public intWinnings(10) As Integer
Public bolWin As Boolean
Public Function Sleep(ByVal lngSleep As Long)
Dim lngSleepEnd As Long
lngSleepEnd = GetTickCount + lngSleep
While GetTickCount <= lngSleepEnd
DoEvents
Wend
End Function
Public Function RoundNumber(ByRef RoundN, _
Optional Decimals As Integer)
On Error Resume Next
Dim RoundAmount As Single, Result
'Creates powers to the decimal places
RoundAmount = 10 ^ Decimals
'Creates a whole number, rounds, applies decimal places
Result = (CLng((RoundN) * RoundAmount) / RoundAmount)
RoundN = Result
End Function
Public Function RoundToValue(ByVal nValue, _
nCeiling As Double, Optional RoundUp As Boolean = True) _
As Double
Dim tmp As Integer
Dim tmpVal
If Not IsNumeric(nValue) Then Exit Function
nValue = CDbl(nValue)
'Round up to a whole integer -
'Any decimal value will force a round to the next integer.
'i.e. 0.01 = 1 or 0.8 = 1
tmpVal = ((nValue / nCeiling) + (-0.5 + (RoundUp And 1)))
tmp = Fix(tmpVal)
tmpVal = CInt((tmpVal - tmp) * 10 ^ 0)
nValue = tmp + tmpVal / 10 ^ 0
'Multiply by ceiling value to set RoundtoValue
RoundToValue = nValue * nCeiling
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -