I am optimizing my code performance and have found a bottleneck (see the code attached). The idea is to get a relative position of a record (fundID) in the recordset sorted on various field.
The bad thing here is dumping data to a variant array and looping throughout this array.
How can I optimize this? Is there a way to get a record position position directly from a recordset without looping through?
Call Recordset.Open(SQL1, conHFI, CursorTypeEnum.adOpenForwardOnly, LockTypeEnum.adLockreadOnly, CommandTypeEnum.adCmdText)
Recordset.Sort = "[ratio1] asc"
FundData = Recordset.GetRows()
FundsTotal = UBound(FundData, 2)
For i = 0 To FundsTotal
If (FundData(2, i) = fundID) Then GoTo A0