SiddersAtHome
Board Regular
- Joined
- Nov 2, 2005
- Messages
- 119
Hi
I have created a form which I want to add 20 labels to. By default if I just add them off the tool box, they will be called Label1 Label2 Label3 etc.
However, I want these labels to appear in two columns which will eventually hold input and output file names. Instead of having a piece of code that "calculates" which column a label is in particularly as I may be adding more label later, is there a way that I can re-name the labels to my own naming convention without having to edit all the names individually in the properties box.
So, I would like to rename the first 10 labels as lblInput1, lblInput2 etc. and the next 20 as lblOutput1, lblOutput2 and so on.
I have tried running some vb code using ctl.name = "lblInput" & MyCounter but I get an error saying this cannot be done in runtime.
I would prefer that I could then save the form (or the workbook the form is on) so that next time I open it, they still have their new names. Worst case is I have to run the re-name code every time I open the file which would not be ideal but workable.
Many thanks
Sidders
I have created a form which I want to add 20 labels to. By default if I just add them off the tool box, they will be called Label1 Label2 Label3 etc.
However, I want these labels to appear in two columns which will eventually hold input and output file names. Instead of having a piece of code that "calculates" which column a label is in particularly as I may be adding more label later, is there a way that I can re-name the labels to my own naming convention without having to edit all the names individually in the properties box.
So, I would like to rename the first 10 labels as lblInput1, lblInput2 etc. and the next 20 as lblOutput1, lblOutput2 and so on.
I have tried running some vb code using ctl.name = "lblInput" & MyCounter but I get an error saying this cannot be done in runtime.
I would prefer that I could then save the form (or the workbook the form is on) so that next time I open it, they still have their new names. Worst case is I have to run the re-name code every time I open the file which would not be ideal but workable.
Many thanks
Sidders