I have two arrays - MyTArray and CtrArray - both of which have 5 variables. The variables refer to 2 corresponding sets of 5 textboxes on the same userform.
How do I make the 5 variables in the first array correspond with the variables in the second array? So I need to relate MyTArray(1) to CtrArray(1), MyTArray(2) to CtrArray(2) and so on.
I am trying to perform a look-up for each value in MyTArray (in another array my4Array) and return a value from the second column in each corresponding textbox in CtrArray.
This is a snippet of the code where I hope you can see what I'm trying to achieve:
The above is not returning a value in CtrArray textboxes. I know the issue is with the For/Next statement in the middle of the CtrArray as when I run it for a single variable specifying CtrArray(1) for example it does return a correct value.
Can anyone explain how I can relate the MyTArray to CtrArray please so that the look-up values are returned to the corresponding textboxes?
How do I make the 5 variables in the first array correspond with the variables in the second array? So I need to relate MyTArray(1) to CtrArray(1), MyTArray(2) to CtrArray(2) and so on.
I am trying to perform a look-up for each value in MyTArray (in another array my4Array) and return a value from the second column in each corresponding textbox in CtrArray.
This is a snippet of the code where I hope you can see what I'm trying to achieve:
VBA Code:
For i = 1 To UBound(MyTArray)
If MyTArray(i) <> "" Then
For k = LBound(my4Array, 1) To UBound(my4Array, 1)
If my4Array(k, 1) = Left(MyTArray(1), 4) Then
For m = 1 To UBound(CtrArray)
CtrArray(m).Text = ActiveWorkbook.Sheets("Sheet1").Cells(k, 2).Value
Next m
End If
Next
End If
Next i
The above is not returning a value in CtrArray textboxes. I know the issue is with the For/Next statement in the middle of the CtrArray as when I run it for a single variable specifying CtrArray(1) for example it does return a correct value.
Can anyone explain how I can relate the MyTArray to CtrArray please so that the look-up values are returned to the corresponding textboxes?