![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Feb 2002
Posts: 42
|
is it possible to carry the value of a variable defined in one user form into another user form?
I can do it across modules using the 'public' declaration public myvariable as string the variable retains its value in a different module no problem. Do the same in a form (setting the variable by taking the value of a text box) and its fine until I switch to the next user form where the variable is empty! This is really bugging me! Anyone able to help, simple code available if needed. Andy |
|
|
|
|
|
#2 |
|
Guest
Posts: n/a
|
If you have two UserForms with textboxes, then you can refer to the textbox on the other form from within the form module as follows: -
TextBox1.Text= UserForm2.TextBox.Text If that doesn't help, consider hiving off anything that deals with variables into a normal module procedure, called in response to an event on your UserForm. As a simple example if you press command button 1 on your first UserForm, then call your procedure from that click event, assign the textbox value (say) to your variable and do your manipulation within the standard module. Hope that helps, if you post more specifics, then I could give you some more advice. |
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: SRC
Posts: 165
|
From what I understand you need to create a public variable in a module sheet and assign it to be equal to the text box then when the new user form is needed assign the text box in this to be equal to the public variable in the module.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|