Multiple Identical UserForms

C

Craig

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
 
T

Tom Ogilvy

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.
 
C

Craig

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top