LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Change label name with loop

Suppose I have a userform with 10 labels on it named
Label1, Lable2, Label3 ... Label10. These labels have different
captions depending on user chosen uses.
The captions can be defined by different arrays such as
vArray1=Array("Apples", "Oranges" ,"Lemons"...)
vArray2=Array("Red","Yellow","Blue",...)

Is it possible to change the captions using a For statement like

Sub LabelCaptions
Dim oLabel as control, i as integer
With UserForm1
For i = 1 To 10
Set oLabel =( "Label" & i )
oLabel.Caption = vArray1(i)
Next
End With
End Sub

When I try this I get an Error at the Set Statment
How can I set oLabel to the variable name
Thanks
Merlyn
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change all label controltiptexts in userform [email protected] Excel Programming 6 July 30th 08 03:56 PM
how to change width of label box in pie chart me@rrc Charts and Charting in Excel 6 July 20th 07 09:26 AM
change label font Jordan Excel Programming 1 February 9th 07 02:09 AM
change label on multipage [email protected] Excel Programming 3 August 27th 06 05:51 PM
On Error GoTo Label in a loop only working once. Ken Johnson Charts and Charting in Excel 4 July 5th 06 09:39 PM


All times are GMT +1. The time now is 12:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"