I made kinda of an array named arActLvlDetails.
I want it to be returned by the Function but
seemed to have an error in the last part.
Here's the code:
----------------------------------------------------
Private Function GetExcelData(objExcel As Object) As Object
Dim arActLvlDetails As Object
Set arActLvlDetails = CreateObject("Scripting.Dictionary")
For i = 1 To 6
arActLvlDetails.Add "AA" & i, objExcel.Worksheets(1).Range("A" & (2 + i)).Value
arActLvlDetails.Add "BB" & i, objExcel.Worksheets(1).Range("B" & (2 + i)).Value
arActLvlDetails.Add "CC" & i, objExcel.Worksheets(1).Range("C" & (2 + i)).Value
Next i
GetExcelData = arActLvlDetails '<-- Error occurs here!
End Function
----------------------------------------------------
The error occurs in this line:
GetExcelData = arActLvlDetails
Is it because the datatype of the function is Object and different from arActLvlDetails?
Since I want to return the arActLvlDetails, what should be done to accomplish it?
Need the details for a greater good.
The example here retrieves 3 cell values from an excel only.
I'll be retrieving around 100 cell values.
Got any good advice on how to implement it?
keirnus
I want it to be returned by the Function but
seemed to have an error in the last part.
Here's the code:
----------------------------------------------------
Private Function GetExcelData(objExcel As Object) As Object
Dim arActLvlDetails As Object
Set arActLvlDetails = CreateObject("Scripting.Dictionary")
For i = 1 To 6
arActLvlDetails.Add "AA" & i, objExcel.Worksheets(1).Range("A" & (2 + i)).Value
arActLvlDetails.Add "BB" & i, objExcel.Worksheets(1).Range("B" & (2 + i)).Value
arActLvlDetails.Add "CC" & i, objExcel.Worksheets(1).Range("C" & (2 + i)).Value
Next i
GetExcelData = arActLvlDetails '<-- Error occurs here!

End Function
----------------------------------------------------
The error occurs in this line:
GetExcelData = arActLvlDetails
Is it because the datatype of the function is Object and different from arActLvlDetails?
Since I want to return the arActLvlDetails, what should be done to accomplish it?
Need the details for a greater good.
The example here retrieves 3 cell values from an excel only.
I'll be retrieving around 100 cell values.
Got any good advice on how to implement it?

keirnus