bvs123
08-06-2011, 04:17 AM
Hi,
I have two userforms, let's say UserForm1 and UserForms2.
When pressing a button on UserForm2, 12 txtFields on UserForm1 should be filled.
It works if I would create 12 lines like:
UserForm1.txtField1.Value = Range1.Offset(0, 20)
UserForm1.txtField2.Value = Range1.Offset(0, 21)
etc.
But I would like to create this via a for loop, I came up with the thing below but it does not work.
Dim k As Long
For k = 1 To 12
UserForm1.txtField & k & .Value = Range1.Offset(0, k + 19)
Next k
Please help me. Thanks in advance!
I have two userforms, let's say UserForm1 and UserForms2.
When pressing a button on UserForm2, 12 txtFields on UserForm1 should be filled.
It works if I would create 12 lines like:
UserForm1.txtField1.Value = Range1.Offset(0, 20)
UserForm1.txtField2.Value = Range1.Offset(0, 21)
etc.
But I would like to create this via a for loop, I came up with the thing below but it does not work.
Dim k As Long
For k = 1 To 12
UserForm1.txtField & k & .Value = Range1.Offset(0, k + 19)
Next k
Please help me. Thanks in advance!