Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Jeff
 
Posts: n/a
Default Userform and variables

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.




  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Userform and variables

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

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"Jeff" wrote in message
...
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.






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Variables and graphs teepee Excel Discussion (Misc queries) 7 January 2nd 06 11:47 PM
VBA passing variables through a function Jeff Excel Discussion (Misc queries) 2 November 3rd 05 11:23 PM
Select Text Files from Combobox D.Parker Excel Discussion (Misc queries) 4 June 28th 05 03:46 PM


All times are GMT +1. The time now is 01:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"