Function Name〔(ArgList)〕
〔Statements〕
〔Name = Expression〕
〔Exit Function〕
〔Statements〕
〔Name = Expression〕
End〔Function〕
' 入力データを比較し,昇順に表示します。
Dim compnum1,compnum2
InputBox ( "比較する数値を入力してください。","データ入力", _
100, 100, compnum1, "数値1" ,compnum2, "数値2" )
If NumberCompare( compnum1 , compnum2) <> True Then
lower = compnum2
upper = compnum1
Else
lower = compnum1
upper = compnum2
End If
Messagebox( "lower=[" & lower & "] , upper=[" & upper & "]" )
Function NumberCompare(p1, p2)
NumberCompare =True
Dim lower,upper
lower = p1
upper = p2
If lower > upper Then
NumberCompare = False
Exit Function
End If
End Function