Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Maintaing public array values in a user form
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Maintaing public array values in a user form
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 Chet wrote: 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 -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Passing Array of User Defined Type to Form | Excel Programming | |||
User form return values | Excel Programming | |||
user form, saving values | Excel Programming | |||
Public Array in a form? | Excel Programming | |||
returning values from a User Form | Excel Programming |