Suppose I have an array arr1 which contains date values as below :
Arr1(50)=(“9/3/2012 4:57:02 AM”,”22/3/2012 5:57:02 AM”,”9/5/2012 8:57:02 AM”,”9/3/2011 4:57:02 AM”)
Edit
Dim CellCount
Dim Arr(10)
CellCount=0
Do Untill arr(CellCount)="" And Ubound(Arr)>9
If CStr(arr(CellCount) < arr(CellCount+1)) Then
MsgBox(arr(CellCount)&"is good")
Else
MsgBox(arr(CellCount +1)&"is bad")
Exit Do
End if
CellCount=CellCount+1
Loop
Now, Is there any direct way,without using any Looping technique,to find out if the Arr1() has the date values ascending or not?
Thanks,
He is answering your question. You asked, is there a way to find if sorted without a loop?
He said no. Your eyes, my eyes can see if it’s sorted or not. But how do you expect Excel/computer to do so without going through collections elements?
When data is in an array, you need to loop through its elements. Hope it’s clear.
So the best I could say,
Rangeusing Transposeuse Sheet sorting method/function to sort the range as a whole
—> so you know it’s now sorted.
Some code snippet to get you going on this direction:
In terms of to-from sheet to code traffic can slow down your performance when you are handling large amount of data.
And please do know that when someone in SO who has credibility answers (E.g. Ekkehard’s answer) you gotta pay some attention. They don’t say it for no proper reason.