Welcome to the forum.
There are various ways to return arrays from function. I would probably do this (and have done similar things) with a user-defined data type. Here's an example:
Type uPartRecd
sName As String ' part name
sPN As String ' part number
nComp As Long ' number of components
asComp(1 To 20) As String ' components by name
End Type
Sub x()
Dim auPart() As uPartRecd
Dim i As Long
ReDim auPart(1 To 100)
auPart(1) = getPart
With auPart(1)
Debug.Print .sName, .sPN, .nComp
For i = 1 To .nComp
Debug.Print i, .asComp(i)
Next i
End With
End Sub
Function getPart() As uPartRecd
With getPart
.sName = "Axle"
.sPN = "1234-012"
.nComp = 3
.asComp(1) = "case"
.asComp(2) = "widget"
.asComp(3) = "thingee"
End With
End Function
I'd spend a lot of time thinking about data structures before launching into this.
Bookmarks