I have an array of SQL statements which i loop through, execute, obtain the results and paste.
Most of the statements return just the one value but one of the SQL functions returns four values. I would like to hold an array of ranges which I can just paste the results of each SQL function into.
What would be the correct code from the point I return the recordset, to the point which I paste the recordset data, which would work for 1 value results and 4 value results? Should I be using Something = rs.getrows
?? and what paste statement should I use?
The four value-result will be pasted into a vertical range of four cells, named X.
EDIT, got this so far:
For i = LBound(SQLFunctionArray, 1) To UBound(SQLFunctionArray, 1)
If UseCurrencyAsArg(i) = True Then
SecondArg = Ccy
Else
SecondArg = FileName
End If
SQLFunctionToCall = SQLFunctionArray(i)
Range(RangeForPasting(i)) = WorksheetFunction.Transpose(GetSQLData(COB, SecondArg, SQLFunctionToCall))
Next
but it doesnt work for the four-value SQL result. GetSQLData returns the rs.getrows
array