Forum Discussion
'####################################################################################################
'# Function Name : fn_ValidateArrayOrder
'# Description : This method will verfy an array is ascending or descending order
'# Input parameters : arrInput,strOrderType
'# arrInput : Array as input
'# strOrderType : ASCENDING or DESCENDING
'# Return Value : True or False
'####################################################################################################
Function fn_ValidateArrayOrder(arrInput,strOrderType)
On Error resume Next
Dim BlnFlag
BlnFlag = False
Select Case UCase(strOrdertype)
Case "ASCENDING"
For i = 0 to UBound(arrInput)-1
If StrComp(arrInput(i), arrInput(i+1), 1)=-1 Then
BlnFlag = True
End If
Next
Case "DESCENDING"
For i = 0 to UBound(arrInput)-1
If StrComp(arrInput(i), arrInput(i+1), 1)=1 Then
BlnFlag = True
End If
Next
End Select
fn_ValidateArrayOrder=BlnFlag
End Function
Please try to use this code ,it may be help you.
Related Content
- 4 years ago
- 7 years ago
- 4 years ago
- 2 years ago
Recent Discussions
- 11 hours ago