Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Using the same variable in separate userform modules

Hello all,

Here's my question, I have created 2 userforms, the first is the main
one used simply for data entry and some calculations.

The second userform is called from the first userform using the Show
command, this is used to perform a simple search on the already
entered data and get a row number on a match.

I have defined 2 Public variables in the declarations section of the
first userform

Public CurRow as string
Used to store the row number

Public LoadJob as boolean
Used to tell if the user wants to load the data, True to load, False
to not load.

The Subs in the second userform module can see these variables and
assign them values (I'm assuming they can because I get no error
messages) however when I return to the first userform module after the
Show command the variables have been reset.

Are the assigned values only valid during the second modules scope of
operation?

Any ideas or suggestions would be appreciated

Thanks

DarrenW
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Using the same variable in separate userform modules

try on Module1
Option Explicit

Public Type DistributorData
dName As String
dUserID As Long
End Type

and at the top of the form type
Dim Dist as DistributorData

J.Rojas

"papou" wrote in message
...
Hello Darren
Not too sure about public variables on userforms!
I would simply suggest that you declare these variables in the

declarations
section of a standard module.
HTH
Regards
Pascal

"DarrenW" a écrit dans le

message
de news: ...
Hello all,

Here's my question, I have created 2 userforms, the first is the main
one used simply for data entry and some calculations.

The second userform is called from the first userform using the Show
command, this is used to perform a simple search on the already
entered data and get a row number on a match.

I have defined 2 Public variables in the declarations section of the
first userform

Public CurRow as string
Used to store the row number

Public LoadJob as boolean
Used to tell if the user wants to load the data, True to load, False
to not load.

The Subs in the second userform module can see these variables and
assign them values (I'm assuming they can because I get no error
messages) however when I return to the first userform module after the
Show command the variables have been reset.

Are the assigned values only valid during the second modules scope of
operation?

Any ideas or suggestions would be appreciated

Thanks

DarrenW





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
Passing variable values to userform control KJ-clueless Excel Discussion (Misc queries) 2 November 27th 07 10:51 PM
Calling a Userform from a Predefined Variable [email protected] Excel Worksheet Functions 0 April 21st 07 03:44 PM
Userform and variable Jeff Excel Discussion (Misc queries) 1 March 16th 07 03:14 PM
Defining UserForm Caption from a Variable [email protected] Excel Worksheet Functions 1 January 3rd 07 02:30 PM
Userform button setting variable from formula teepee Excel Discussion (Misc queries) 4 January 4th 06 06:59 PM


All times are GMT +1. The time now is 01:49 PM.

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"