Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
First, this is a plain text newsgroup--attachments and HTML/RTF posts aren't
welcomed by most. Dim i as long for i = 1 to 20 frmcreated.controls("lstate" & i).caption = "" next i If this is in code that is in the userform module, I'd use: me.controls("lstate" & i).caption = "" 81147leo wrote: Good Morning, I have a user form with 20 labels on it - named 'lstate1' through 'lstate20'. I would like to be able to set/clear the captions property within a loop by using a variable to modify the label name. Something like this - Sub frmclr() dim i as integer i =1 For i = i to 20 frmcreated.lstate1.caption = "" next i End sub . . .but using the variable 'i' in place of the numeric in the label name to select the proper label. I'm using a 'For each ctrl in Controls' routine that works but I'd like to do it with the method suggested above. thanks, Leo -- Dave Peterson |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for changing format <bg.
And you're welcome. 81147leo wrote: My apologies for using the wrong format. Many thanks for the solution to the problem. Dave Peterson wrote: First, this is a plain text newsgroup--attachments and HTML/RTF posts aren't welcomed by most. Dim i as long for i = 1 to 20 frmcreated.controls("lstate" & i).caption = "" next i If this is in code that is in the userform module, I'd use: me.controls("lstate" & i).caption = "" 81147leo wrote: Good Morning, I have a user form with 20 labels on it - named 'lstate1' through 'lstate20'. I would like to be able to set/clear the captions property within a loop by using a variable to modify the label name. Something like this - Sub frmclr() dim i as integer i =1 For i = i to 20 frmcreated.lstate1.caption = "" next i End sub . . .but using the variable 'i' in place of the numeric in the label name to select the proper label. I'm using a 'For each ctrl in Controls' routine that works but I'd like to do it with the method suggested above. thanks, Leo -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Good Morning,
I have a user form with 20 labels on it - named 'lstate1' through 'lstate20'. I would like to be able to set/clear the captions property within a loop by using a variable to modify the label name. Something like this - Sub frmclr() dim i as integer i =1 For i = i to 20 frmcreated.lstate1.caption = "" next i End sub . . .but using the variable 'i' in place of the numeric in the label name to select the proper label. I'm using a 'For each ctrl in Controls' routine that works but I'd like to do it with the method suggested above. thanks, Leo |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
My apologies for using the wrong format.
Many thanks for the solution to the problem. Dave Peterson wrote: First, this is a plain text newsgroup--attachments and HTML/RTF posts aren't welcomed by most. Dim i as long for i = 1 to 20 frmcreated.controls("lstate" & i).caption = "" next i If this is in code that is in the userform module, I'd use: me.controls("lstate" & i).caption = "" 81147leo wrote: Good Morning, I have a user form with 20 labels on it - named 'lstate1' through 'lstate20'. I would like to be able to set/clear the captions property within a loop by using a variable to modify the label name. Something like this - Sub frmclr() dim i as integer i =1 For i = i to 20 frmcreated.lstate1.caption = "" next i End sub . . .but using the variable 'i' in place of the numeric in the label name to select the proper label. I'm using a 'For each ctrl in Controls' routine that works but I'd like to do it with the method suggested above. thanks, Leo |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Setting worksheet properties | Excel Programming | |||
Setting printing properties | Excel Programming | |||
Setting Tab Properties in Excel | Excel Discussion (Misc queries) | |||
Label Scroll Bar Properties: Make Visible? | Excel Programming | |||
setting properties for shapes | Excel Programming |