Ivan Howard
Active Member
- Joined
- Nov 10, 2004
- Messages
- 333
Hi All,
Please could someone give me a hand. I'm not sure if this can be done the way I am trying to do it.
Basically, I have a userform with 40 labels on it (amongst other objects) and would like to update the BackColor property using a "For... Next" statement - instead of writing 40 lines of code... My thoughts are along the lines of the following code but I can't get it to work.
My labels are named "lbl_01" through to "lbl_40"
I'm using Excel 2016.
Any help will be greatly appreciated.
Thanks very much.
Ivan
Please could someone give me a hand. I'm not sure if this can be done the way I am trying to do it.
Basically, I have a userform with 40 labels on it (amongst other objects) and would like to update the BackColor property using a "For... Next" statement - instead of writing 40 lines of code... My thoughts are along the lines of the following code but I can't get it to work.
My labels are named "lbl_01" through to "lbl_40"
Code:
For t = 1 to 40
"Userform1.lbl_" & format (t, "00") & ".BackColor = RGB(255, 0, 0)"
Next t
I'm using Excel 2016.
Any help will be greatly appreciated.
Thanks very much.
Ivan