Maintaing public array values in a user form

C

Chet

I am having a problem where a have a main module where i declared an
array to be public then i go to a user form and get the user input and
in the user form code module i fill the public array but then after
the user form is closed the public array values disappear. I thought
the values would stay because I declared the array to be public. What
might I be missing or doing wrong?

Is above the main code module..
Public DOWSelected(1 To 20) As String

part of my form module
'CREATE FILE NAME TO BE OPENED
If MaxFileNbr < 1 Then
GoTo JumpPastAssignments
Else
If MatrixGrp1Sat Then
DOWSelected(1) = "sat"
GoTo JumpOut1
End If
If MatrixGrp1Sun Then
DOWSelected(1) = "sun"
GoTo JumpOut1
End If
If MatrixGrp1Tue Then Grp1Tue = "t" Else Grp1Tue = "_"
If MatrixGrp1Wed Then Grp1Wed = "w" Else Grp1Wed = "_"
If MatrixGrp1Thu Then Grp1Thu = "t" Else Grp1Thu = "_"
If MatrixGrp1Fri Then Grp1Fri = "f" Else Grp1Fri = "_"
DOWSelected(1) = Grp1Tue & Grp1Wed & Grp1Thu & Grp1Fri
JumpOut1:
End If




Thanks,
Chet
 
D

Dave Peterson

If you're testing the code and you hit the reset button (in the VBE), you're
public variables will go back to their defaults.

If your code has an "End" statement (that's executed), then they'll also go back
to their defaults.

I mean "End" by itself--not "End If", "End Sub", "End Function", ...

You may have used it to exit all running macros:

if somevalue = true then end
 

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