Global (Module) Variable Problem

G

Guest

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
 
G

Guest

Perfect. Thanks a million Chip!!!!

-Allen



Chip Pearson said:
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


message
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top