Hi choco140,
You can't concatenate variable names directly, as VBA will not understand
it. You can, however, work with the Controls collection to do this:
Dim i As Integer
For i = 1 To 4
Me.Controls("Date" & CStr(i)).Text = _
Sheets("Sheet1").Cells(i, 1).Value
Next i
--
Regards,
Jake Marx
www.longhead.com
choco140 wrote:
I got four control on an userform named Date1, Date2, Date3 and Date4.
I am trying to fill them in with this small macro, it doesn't work
because my concatenation doesn't seem to be properly set up...
Sub Test
For i = 1 to 4
Date & i &.value = Range("A" & i).Value
Next i
End Sub
I got an error for "Date & i &.value", any idea how to solve this?
Thanks.