Re: Loop through values in userform to store in array
The controls seem to be consistently named so you should be able to loop through them using their names.
Actually, I'll take that back, some of the controls are named consistently, specifically the first 3 rows on the Materials tab.
If all the controls were named consistently you could use something like this.
Dim arrMaterials(1 To 21, 1 To 5)
Dim I As Long
For I = 1 To 21
arrMaterials(I, 1) = Me.Controls("cmb_Materials_Line" & I & "_Item").Value
arrMaterials(I, 2) = Me.Controls("txt_Materials_Line" & I & "_Color").Value
arrMaterials(I, 3) = Me.Controls("txt_Materials_Line" & I & "_Qty").Value
arrMaterials(I, 4) = Me.Controls("txt_Materials_Line" & I & "_Price").Value
arrMaterials(I, 5) = Me.Controls("txt_Materials_Line" & I & "_Extended").Value
Next I
Display More
By the way, have you considered using a multi-column listbox, one line of controls and a command button for materials?
The user would select/enter data in the line of controls and then click the command button to add them to the listbox.
You could also have buttons to edit/delete rows in the listbox.
With that setup it would be easier to work with the data on the Materials tab.