Userform and variables

J

Jeff

Hi,

I have a userform: their are input boxes and the user inputs values. I am
writing code to read the values and then perform more calculations. The code
is in the modules and the variables that are input into the userform are in
the userform. So for example in the userform:

Private Sub TextBox2_Change()
Y = TextBox2.Value
End Sub

Then in the module I use Y for some calculations. Problem = I tried
declaring Y as a public variable but it loses its value when it is called in
the module.
Does anyone know how to get around this problem

Thanks for your help.
 
B

Bob Phillips

Declare it as a Public variable within the module, not the userform.

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)
 

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