Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Table from labels
If you dim an array as labels you ned to refer to it as labels, not label (an array is not like a collection)
Dim labels(5) labels(0) = Label1.Caption labesl(1) = Label2.Caption -- John Green - Excel MVP Sydney Australia "T.K Kullervo" wrote in message ... I want to refer to many labels inside a for loop. Is it possible to make a table from the labels like labels(5)? I tried Dim labels(5) as label label(0) = Label1.. And so on How is it done right? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Table from labels
Yes, but i want to control my labels in a for-loop
Like this For i = 0 To 5 Labels(i).Text = "This text is in every label after the loop" Next i How can i do this? "John Green" wrote in message ... If you dim an array as labels you ned to refer to it as labels, not label (an array is not like a collection) Dim labels(5) labels(0) = Label1.Caption labesl(1) = Label2.Caption -- John Green - Excel MVP Sydney Australia "T.K Kullervo" wrote in message ... I want to refer to many labels inside a for loop. Is it possible to make a table from the labels like labels(5)? I tried Dim labels(5) as label label(0) = Label1.. And so on How is it done right? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Table from labels
If you are talking about Label objects created in a worksheet using the Forms toolbar, you can loop through the collection as
follows: Sub Test() Dim i As Integer For i = 1 To 5 ActiveSheet.Labels(i).Caption = "This text is in every label after the loop" Next i End Sub If you are talking about label controls in a userform that you have given names "Label1", "Label2", etc. Private Sub UserForm_Click() Dim i As Integer For i = 1 To 5 Me.Controls("Label" & i).Caption = "This text is in every label after the loop" Next i End Sub -- John Green - Excel MVP Sydney Australia "T.K Kullervo" wrote in message ... Yes, but i want to control my labels in a for-loop Like this For i = 0 To 5 Labels(i).Text = "This text is in every label after the loop" Next i How can i do this? "John Green" wrote in message ... If you dim an array as labels you ned to refer to it as labels, not label (an array is not like a collection) Dim labels(5) labels(0) = Label1.Caption labesl(1) = Label2.Caption -- John Green - Excel MVP Sydney Australia "T.K Kullervo" wrote in message ... I want to refer to many labels inside a for loop. Is it possible to make a table from the labels like labels(5)? I tried Dim labels(5) as label label(0) = Label1.. And so on How is it done right? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I find a value in a table without using the labels? | Excel Worksheet Functions | |||
How do I get labels to repeat in a pivot table? | Excel Worksheet Functions | |||
PIvot Table - Repeat Row Labels | Excel Discussion (Misc queries) | |||
How do I get the Pivot Table row labels to repeat? | Excel Discussion (Misc queries) | |||
How do I repeat labels in a Pivot Table | Excel Discussion (Misc queries) |