I have 60 text boxes in my userform and I would like a quick way to set their values. I currently have:
Dim TextB1_1, TextB1_2, TextB1_3, TextB1_4, TextB1_5, TextB1_6, TextB1_7, TextB1_8, TextB1_9, TextB1_10, TextB1_11, TextB1_12 As String
Dim TextB2_1, TextB2_2, TextB2_3, TextB2_4, TextB2_5, TextB2_6, TextB2_7, TextB2_8, TextB2_9, TextB2_10, TextB2_11, TextB2_12 As String
Dim TextB3_1, TextB3_2, TextB3_3, TextB3_4, TextB3_5, TextB3_6, TextB3_7, TextB3_8, TextB3_9, TextB3_10, TextB3_11, TextB3_12 As String
Dim TextB4_1, TextB4_2, TextB4_3, TextB4_4, TextB4_5, TextB4_6, TextB4_7, TextB4_8, TextB4_9, TextB4_10, TextB4_11, TextB4_12 As String
Dim TextB5_1, TextB5_2, TextB5_3, TextB5_4, TextB5_5, TextB5_6, TextB5_7, TextB5_8, TextB5_9, TextB5_10, TextB5_11, TextB5_12 As String
and to set the values I have:
TextB1_1 = Me.TextBox1_1.Text
TextB1_2 = Me.TextBox2_2.Text
TextB1_3 = Me.TextBox3_3.Text
TextB1_4 = Me.TextBox4_4.Text
TextB1_5 = Me.TextBox5_5.Text
TextB1_6 = Me.TextBox5_6.Text
TextB1_7 = Me.TextBox5_7.Text
TextB1_8 = Me.TextBox5_8.Text
TextB1_9 = Me.TextBox5_9.Text
TextB1_10 = Me.TextBox5_10.Text
TextB1_11 = Me.TextBox5_11.Text
TextB1_12 = Me.TextBox5_12.Text
I need to do the same for text box groups 2,3,4,5 and I though it would be easier to loop it and set the value to I for the group, however it does not work ie
For i = 1 To 5
TextB&i&_1 = Me.TextBox1_1.Text
TextB&i&_2 = Me.TextBox2_2.Text
TextB&i&_3 = Me.TextBox3_3.Text
TextB&i&_4 = Me.TextBox4_4.Text
TextB&i&_5 = Me.TextBox5_5.Text
TextB&i&_6 = Me.TextBox5_6.Text
TextB&i&_7 = Me.TextBox5_7.Text
TextB&i&_8 = Me.TextBox5_8.Text
TextB&i&_9 = Me.TextBox5_9.Text
TextB&i&_10 = Me.TextBox5_10.Text
TextB&i&_11 = Me.TextBox5_11.Text
TextB&i&_12 = Me.TextBox5_12.Text
Next I
is it possible to loop as such, and if so, what do I need to do as I cant get this to work. I have tried TextB1_&i too just in case that would simplify it, but that does not work either
DataGridViewmay be easier to implement. 12 columns with 5 rows.