Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
CONCATANATE | Excel Worksheet Functions | |||
Runtime Error '91' Object variable or With block variable not set | Excel Discussion (Misc queries) | |||
variable height variable width stacked bar charts | Charts and Charting in Excel | |||
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? | Excel Worksheet Functions | |||
Formatting range in concatanate | Excel Discussion (Misc queries) |