Last active
March 22, 2017 16:39
-
-
Save wizard04wsu/d1c7b2c3dcdae62b3743 to your computer and use it in GitHub Desktop.
VBA Max and Min functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function max(ParamArray ListItems() As Variant) | |
Dim i As Integer | |
If UBound(ListItems) >= 0 Then | |
max = ListItems(0) | |
For i = 1 To UBound(ListItems) | |
If ListItems(i) > max Then max = ListItems(i) | |
Next i | |
End If | |
End Function | |
Function min(ParamArray ListItems() As Variant) | |
Dim i As Integer | |
If UBound(ListItems) >= 0 Then | |
min = ListItems(0) | |
For i = 1 To UBound(ListItems) | |
If ListItems(i) < min Then min = ListItems(i) | |
Next i | |
End If | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment