Click to See Complete Forum and Search --> : RESOLVED[Userform1 to userform2]
Fonty
May 23rd, 2006, 12:31 PM
I have 2 userforms. In userform1 I entered some data through a combobox and stored it in a variable defined as a string. Then from userform1, once you've finished filling it, you pass to userform2.
How can you bring to userform2 the data from the combobox in userform1 stored in that variable?
RobDog888
May 23rd, 2006, 12:52 PM
Place the variable declaration in a Module. Make it Public blah As String and it will be afvauilable to any userform or sheet.
Fonty
May 23rd, 2006, 01:21 PM
I created a module with:
Sub region()
Public region As String
End Sub
However, when I put in the userform
region= cboRegion.Value
it happens to be an error. What am I doing wrong?
RobDog888
May 23rd, 2006, 01:32 PM
Should be like this ...
Option Explicit
Public strRegion As StringThen to use anywhere:
Private Sub Command1_Click()
strRegion = "West Side!"
MsgBox strRegion
End Sub
Fonty
May 23rd, 2006, 01:43 PM
Sorry... I still don't get it. Where do I write Option Explicit?
RobDog888
May 23rd, 2006, 01:45 PM
In a new standard Module. You can add it to your project if you dont have one by right clicking on the project file in the VBA IDE Project explorer and selecting Insert Module.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.