Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Global (Module) Variable Problem

In Module "This Workbook" I've declared a global variable using the following
statement:

Public mSelection As Integer



In a UserForm, I've assigned a value to the variable using the following
statement:

Private Sub btnSprintSubmit_Click()

mSelection = lbSprint.ListIndex

End Sub



Now, in ANOTHER UserForm, I have a Case Statement that fills in all of the
labels on the UserForm, based on the value of mSelection. But, when I step
through the code in that UserForm, the value of mSelection is "Empty". How
come the value of mSelections isn't passing from one UserForm to the next?
Am I declaring the global variable incorrectly? Any help/advice/tips are
greatly appreciated! Thank you

-Allen
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Global (Module) Variable Problem

Take the variable mSelection out of the ThisWorkbook module and
put it in a standard code module.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Allen Geddes" wrote in
message
...
In Module "This Workbook" I've declared a global variable using
the following
statement:

Public mSelection As Integer



In a UserForm, I've assigned a value to the variable using the
following
statement:

Private Sub btnSprintSubmit_Click()

mSelection = lbSprint.ListIndex

End Sub



Now, in ANOTHER UserForm, I have a Case Statement that fills in
all of the
labels on the UserForm, based on the value of mSelection. But,
when I step
through the code in that UserForm, the value of mSelection is
"Empty". How
come the value of mSelections isn't passing from one UserForm
to the next?
Am I declaring the global variable incorrectly? Any
help/advice/tips are
greatly appreciated! Thank you

-Allen



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Global (Module) Variable Problem

Perfect. Thanks a million Chip!!!!

-Allen



"Chip Pearson" wrote:

Take the variable mSelection out of the ThisWorkbook module and
put it in a standard code module.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Allen Geddes" wrote in
message
...
In Module "This Workbook" I've declared a global variable using
the following
statement:

Public mSelection As Integer



In a UserForm, I've assigned a value to the variable using the
following
statement:

Private Sub btnSprintSubmit_Click()

mSelection = lbSprint.ListIndex

End Sub



Now, in ANOTHER UserForm, I have a Case Statement that fills in
all of the
labels on the UserForm, based on the value of mSelection. But,
when I step
through the code in that UserForm, the value of mSelection is
"Empty". How
come the value of mSelections isn't passing from one UserForm
to the next?
Am I declaring the global variable incorrectly? Any
help/advice/tips are
greatly appreciated! Thank you

-Allen




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
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Excel Worksheet Functions 1 July 9th 05 03:05 AM
Create Global Variables in a module Bruce Excel Programming 1 June 1st 04 07:55 AM
Global module Al Excel Programming 2 April 30th 04 12:02 PM
Global variable Don[_11_] Excel Programming 1 October 28th 03 04:15 AM
Variable from a sheet module in a class module in XL XP hglamy[_2_] Excel Programming 2 October 14th 03 05:48 PM


All times are GMT +1. The time now is 01:44 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"