LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Public Variables with UserForms

I have read with interest many forum posts about the use of Public
variables in Excel VBA.
I was blithely unaware of variable lifetimes (coming from a Fortan/VAX
background) and came a cropper recently. I now try to do without
Public declarations, directly pass the variables from one sub to the
next & declare everything within the procedure.

However, my question is how to do this with UserForms. For instance, I
have a Chart progress UserForm which has the activation following code
:

Private Sub UserForm_Activate()
Dim PctDone As Single
PctDone = Active_Chart / cochar
With UF_UpdateAllCharts_Progress
.FrameProgress.Caption = ForMat(Round(PctDone, 2), "0%")
.LabelProgress.Width = PctDone * (.FrameProgress.Width - 10)
.Repaint
End With
If PctDone = 1 Then
Unload UF_UpdateAllCharts_Progress
Else
UF_UpdateAllCharts_Progress.Hide
End If
End Sub

I call the UserForm as normal from a procedure,
UF_UpdateAllCharts_Progress.Show

I need to transfer the Active_Chart and cochar integer values from the
module … the only way I can think is to use Public variables.

Can anyone please point me in the right direction?

Cheers,

Mark
 
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
Public Variables and Combo Box Usage KC[_2_] Excel Discussion (Misc queries) 0 October 19th 09 07:49 PM
Declare and Set Public variables jlclyde Excel Discussion (Misc queries) 2 January 28th 09 02:16 PM
public variables johnny Excel Discussion (Misc queries) 7 February 27th 08 03:44 PM
Public variables johnny Excel Discussion (Misc queries) 2 February 24th 08 05:05 AM
Public Variables Jerry McNabb Excel Discussion (Misc queries) 0 February 24th 08 01:26 AM


All times are GMT +1. The time now is 04:03 AM.

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"