Maybe:
Private Sub UserForm_Initialize()
Dim lbl As Object
Dim i As Integer
i = 1
With Sheets("Sheet1")
For Each lbl In Me.Controls
If TypeName(lbl) = "Label" Then
lbl.Caption = .Cells(i, 1).Value
i = i + 1
End If
Next lbl
End With
End Sub
Hope this helps
Rowan
"justchris" wrote:
Hi... been a while since i've posted here so Welcome back me!
I got a question for you all, I have about 30 labels on a userform and
I want my userform, on initilize, to fill those labels with values from
the spreadsheet.
I'm hoping I can set up a small loop to do this and I guess my real
question is How can I loop through 30 labels?
Would probably look like:
Dim LblName as object
dim i as integer
set lblName = userform.controls("label" & LblNumber)
for i = 1 to 30
lblname.*caption* = worksheets("sheet1").cells(1, *i*).value
next i
Any help would be great.. I have a lot of labels and a loop will most
deffinatly help here.
--
justchris
------------------------------------------------------------------------
justchris's Profile: http://www.excelforum.com/member.php...fo&userid=8894
View this thread: http://www.excelforum.com/showthread...hreadid=398025