Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
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 Array of User Defined Type to Form dunnerca Excel Programming 4 December 23rd 07 09:22 PM
User form return values Suhas Excel Programming 0 August 25th 07 08:18 PM
user form, saving values ophelia[_4_] Excel Programming 3 May 5th 06 12:47 PM
Public Array in a form? lux770[_3_] Excel Programming 4 July 28th 05 08:49 AM
returning values from a User Form rohnds[_3_] Excel Programming 2 July 18th 04 04:59 PM


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