Yes, not sure about the "which dynamically shortens or lengthens" part
Option Explicit Sub LoadArray() Dim a As Variant Dim B As Variant Dim i As Long 'needed to make a 1 dim array a = Application.WorksheetFunction.Transpose(ActiveSheet.Cells(1, 1).CurrentRegion) 'we can use this as a 2 dim array B = ActiveSheet.Cells(1, 3).CurrentRegion For i = LBound(a) + 1 To UBound(a) Call SubA(a(i)) Next i For i = LBound(B, 1) + 1 To UBound(B, 1) Call SubB(B(i, 1), B(i, 2)) Next i End Sub Sub SubA(N As Variant) MsgBox "SubA " & 10 * N End Sub Sub SubB(N1 As Variant, N2 As Variant) MsgBox "SubB " & N1 * N2 End Sub




Reply With Quote