PDA

View Full Version : [SOLVED] For loop for different userform



petroj02
11-07-2016, 03:22 AM
Hello guys,
I am trying to figure out, how can I clear 7x Label at userform called Properties by for Loop,when I click at something at different userform for example UserForm1. I can overwrite Label alone, but this Loop gives me an error message and I dont know the right Syntax.




For i = 1 To 7
Properties.Controls(Me("label" & i)).Caption = ""
Next



Every help would be welcome...

petroj02
11-07-2016, 03:56 AM
For i = 1 To 7
Properties.Controls("label" & i).Caption = ""
Next

Here is solution for some reason, me have to be out...

Paul_Hossler
11-07-2016, 09:41 AM
Hello guys,
I am trying to figure out, how can I clear 7x Label at userform called Properties by for Loop,when I click at something at different userform for example UserForm1. I can overwrite Label alone, but this Loop gives me an error message and I dont know the right Syntax.




For i = 1 To 7
Properties.Controls(Me("label" & i)).Caption = ""
Next



Every help would be welcome...

The



Me("label" & I)


was wrong

'Me' would be the user form, and ("label" & I) would be the index into the Controls collection of the Properties userform

So that's why your solution worked