I am writing a code to retrieve a specific date in a (somewhat) large excel spreadsheet(2,000 entries). I just realize that my code will not work and it will only get worse. Could you please advise me.
I give to my function:
- array() that contain my data from an excel spreadsheet
 - FirstDate which is the date I am looking for, as dd mm yyyy
 - DateSave() to save all the position where this date appears (multiple transaction on the same day)
 
The code will not be able to work with a database of 5,000 row as it will have to stack it if the date is at the end of the table. What could I do to fix this issue?
Thank you very much
Function looping(array() As Variant, FirstDate As Date, DateSave() As Long)
    Dim i As Long
    Dim PositionInArray As Long
    PositionInArray = 0
    
    For i = LBound(array, 1) To UBound(array, 1)
        
                If array(i, 1) = FirstDate Then
                    ReDim Preserve DateSave(PositionInArray)
                    DateSave(PositionInArray) = i
                    PositionInArray = PositionInArray + 1
                End If
            
                'If end of list and array not initialize ie. Not value in it
                If i = UBound(array, 1) And (Not DateSave) = -1 Then
                    Call looping(array(), FirstDate + 1, DateSave())
                ElseIf i = UBound(array, 1) Then
                    'Array has been initialized
                    Exit For
                End If
            Next i
End Function
Edit: Change data base to excel spreadsheet