userform control value as constant

L

littleme

Hello

Been trying to find a smooth way around this problem but can't find
anything...Grateful for any advice.
My problem is this:

Have users fill in a userform. Will be using the information entered
in textboxes and chosen from radio buttons over and over again in the
code and send it between functions.

Was hoping to be able to define a public consant but that doesnt work.
Dont want to have to type it eg./ frmrft.cboxA1 all over the place.
Setting myself up for mistakes. What if the A1 is no longer found in
cboxA1 but in txtboxA1...

What I have done until now is define A1 under Ok_click() and then
"sent" it to related functions using Byval. Have ended up with 9 ByVal
for some functions...Is that Ok?

Feels like there should be a better way to do this...

Any suggestions? Anybody?
 
L

littleme

Hi!

Thanks for the quick reply... Im not sure if what you suggested is
what I need... How/where would I use it?
 
B

Bob Phillips

Difficult to say without seeing the code and a better explanation of what
you are doing.
 
L

littleme

Ok.. here goes... I'll give it a shot:

Have a userform where users enter information that is used to derive
10-digit drawing number, eg/ A-43-5-33-0751. Woulddnt present a
problem except that depending on the project, sometimes a "/" is use
instead of "-" and sometimes ".", sometimes nothing... So have set ut
4 groups of radio buttons where user can choose if it should be what
"divisor" sould be used at each position. To make it easy for myself i
dumped the value chosen thorugh a radio-button-click statement into
an (invisible) label. This is label value is then referred to and used
alll over the place in the rest of the project. Lables are called
lbA1, lbA2, lbA3, lbA4

In the ok-click I have set A1=lbA1, A2=lbA2 etc.

Follow me so far?

To be able to use the values of A1-A4 in other subs start them with

sub Plans (A1 byval as string, A2 byval as string, A3 byval as string,
A4 byval as string... etc) Have about 8 values that I need...

It works fine, its just that when i want to trigger Plans or any other
sub that also uses A1-A4, have to type

Plan A1:=A1, A2:=A3, A4:=A4 and so forth

Like I said it works, but was wondering if there was a smoother way to
do it..? Or should I just leave it?

Do you understand what Im trying to explain? Am at work and have the
file at home, so could post exact code later today if need be...

sorry
 
Top