Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
referencing a variable from a form in a module
I have a form with 4 different text boxes in a form. When a command
button is pressed on the form, the values are saved into variables that I want to use in a module sub saved in the same excel workbook, but i seem to be striking out... How do i accomplish this? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
referencing a variable from a form in a module
Dim the variables as public in the declarations section of any module. e.g....
Public myInt as Integer Public myStr as String, myWksh as Worksheet etc... This allows whatever is stored in them to be retained beyond the execution of a specific module that is assigning values to them. "Matthew Dyer" wrote: I have a form with 4 different text boxes in a form. When a command button is pressed on the form, the values are saved into variables that I want to use in a module sub saved in the same excel workbook, but i seem to be striking out... How do i accomplish this? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
referencing a variable from a form in a module
On Oct 7, 1:58*pm, B Lynn B wrote:
Dim the variables as public in the declarations section of any module. e.g.... Public myInt as Integer Public myStr as String, myWksh as Worksheet etc... This allows whatever is stored in them to be retained beyond the execution of a specific module that is assigning values to them. "Matthew Dyer" wrote: I have a form with 4 different text boxes in a form. When a command button is pressed on the form, the values are saved into variables that I want to use in a module sub saved in the same excel workbook, but i seem to be striking out... How do i accomplish this?- Hide quoted text - - Show quoted text - I figured out my problem. My variable had the same name as the text box in my user form. Switched it around and it's working perfectly! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBA code in one Module referencing Public Variables Declared inanother Module failing | Excel Programming | |||
Transfer Variable from Form to Module | Excel Programming | |||
Access variable from form and module? | Excel Programming | |||
Unload A Form based on a Variable in my Module | Excel Programming | |||
Variable from a sheet module in a class module in XL XP | Excel Programming |