ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Multiple Identical UserForms (https://www.excelbanter.com/excel-programming/345506-multiple-identical-userforms.html)

Craig[_21_]

Multiple Identical UserForms
 
Hi there, I have nine identical userfoms that each contain over 100 mixed
controls. Each UserForm has it's own name (frmTicket1, frmTicket2,
frmTicket3..... to frmTicket9). There are procedures which are located
within the UserForms code area with identical procedures with the same names
within each UserForm. The references to the worksheets are different but the
control references are the same. What I would like to know is it best
practice to rename all the controls on each userform, so I don't have any
controls or procedure with the same names? This would be a tedious job. If
so, is there an easier way to change these control names at design time
without having to click on each control and type in a new name? Any
reference to a control is done by using the userform name first
(frmTicket1.txtBox1.Text=
I was just thinking that if I don't need to change all these names... I'm
wasting my time.

Could someone enlighten me on what the best practice in this situation is?

Thanks Craig



Tom Ogilvy

Multiple Identical UserForms
 
You shouldn't need to change the names.

If the only difference in the forms, is the sheet name they reference, it
probably would be easier to have one userform and put in some case
statements in the code or set a variable to the sheet name and use the
variable everywhere else.

--
Regards,
Tom Ogilvy


"Craig" wrote in message
news:WxRdf.498381$1i.150864@pd7tw2no...
Hi there, I have nine identical userfoms that each contain over 100 mixed
controls. Each UserForm has it's own name (frmTicket1, frmTicket2,
frmTicket3..... to frmTicket9). There are procedures which are located
within the UserForms code area with identical procedures with the same

names
within each UserForm. The references to the worksheets are different but

the
control references are the same. What I would like to know is it best
practice to rename all the controls on each userform, so I don't have any
controls or procedure with the same names? This would be a tedious job. If
so, is there an easier way to change these control names at design time
without having to click on each control and type in a new name? Any
reference to a control is done by using the userform name first
(frmTicket1.txtBox1.Text=
I was just thinking that if I don't need to change all these names... I'm
wasting my time.

Could someone enlighten me on what the best practice in this situation is?

Thanks Craig





Craig[_21_]

Multiple Identical UserForms
 
Thanks Tom... I now have one userform and setup variable for the sheet range
references!
Thanks again for helping me out... I should have thought of that, have done
it before. Got mixed up and wasn't thinking clearly!
Thanks Again
Craig

"Tom Ogilvy" wrote in message
...
You shouldn't need to change the names.

If the only difference in the forms, is the sheet name they reference, it
probably would be easier to have one userform and put in some case
statements in the code or set a variable to the sheet name and use the
variable everywhere else.

--
Regards,
Tom Ogilvy


"Craig" wrote in message
news:WxRdf.498381$1i.150864@pd7tw2no...
Hi there, I have nine identical userfoms that each contain over 100 mixed
controls. Each UserForm has it's own name (frmTicket1, frmTicket2,
frmTicket3..... to frmTicket9). There are procedures which are located
within the UserForms code area with identical procedures with the same

names
within each UserForm. The references to the worksheets are different but

the
control references are the same. What I would like to know is it best
practice to rename all the controls on each userform, so I don't have any
controls or procedure with the same names? This would be a tedious job.
If
so, is there an easier way to change these control names at design time
without having to click on each control and type in a new name? Any
reference to a control is done by using the userform name first
(frmTicket1.txtBox1.Text=
I was just thinking that if I don't need to change all these names... I'm
wasting my time.

Could someone enlighten me on what the best practice in this situation
is?

Thanks Craig








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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com