I'm not sure of the progression, but it looks something like this:
Combobox_0
1, 236 (=235+
1)
Combobox_0
2, 237 (=235+
2)
Combobox_0
3, 238 (=235+
3)
Combobox_0
4, 239 (=235+
4)
And for the letters:
A, D11:Q11 (=D11:Q11 offset
0 rows)
B, D12:Q12 (=D11:Q11 offset
1 row)
C, D13:Q13 (=D11:Q11 offset
2 rows)
D, D14:Q14 (=D11:Q11 offset
3 rows)
E, D15:Q15 (=D11:Q11 offset
4 rows)
F, D16:Q16 (=D11:Q11 offset
5 rows)
Since we have placed A,B,C etc. in order in each combobox, as luck would have it the
.listindex of a combobox corresponds to the letter chosen as above shown in
red, so something like (untested):
Code:
With Worksheets("sheet1")
For i = 1 To 4
Set myCtrl = [COLOR=Magenta]UserForm3.[/COLOR]Controls("Combobox_" & Format(i, "00"))
.Range("A" & 235 + i) = myCtrl.Value
.Range("D" & 235 + i & ":Q" & 235 + i).Value = .Range("D11:Q11").Offset(myCtrl.ListIndex).Value
Next i
End With
The
UserForm3. part may need to be adjusted to your userform's name, and depending on where you've put the code, may not need to be there at all.
A variant:
Code:
With Worksheets("sheet1")
For i = 1 To 4
Set myCtrl = UserForm3.Controls("Combobox_" & Format(i, "00"))
myRow = 235 + i
.Cells(myRow, 1).Value = myCtrl.Value
.Cells(myRow, 4).Resize(, 14).Value = .Range("D11:Q11").Offset(myCtrl.ListIndex).Value
Next i
End With