ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dynamic Status Bar Routine (https://www.excelbanter.com/excel-programming/290105-dynamic-status-bar-routine.html)

ExcelMonkey[_66_]

Dynamic Status Bar Routine
 
I normally use status bars with my loops for progress indicators. I
would like to create a separate sub for the status bar and send all my
variables from many loops in my main module to one single status bar
routine.

So if I send the variables to status routine, I can calculate a %
completed stat. But depending on the loop that I am analyzing, I may
want to have different texct associated with the status report.
Example:

25% Completed Loop 1
55% Completed Loop 2
70% Completed Loop 3

My question is, how do I change the text after the calc now that the
status bar is in its own sub? I almost need a Case Stmt within the
statusbar sub that decides what text to use based on where the
variables came from. That is append "Completed Loop 1" if varibles
come from part X of routine etc

Or is it possible to Call the routine and append the text to the call
statement?

Call StatusBar & "Completed Loop 1"


---
Message posted from http://www.ExcelForum.com/


Bob Phillips[_6_]

Dynamic Status Bar Routine
 
Why not pass that part as a argument?

For instance,

Sub DisplayStatusBar(pct As Long, text As String)
Dim sText As String

sText = Format(pct,"0%") & " Completed " & text


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"ExcelMonkey " wrote in message
...
I normally use status bars with my loops for progress indicators. I
would like to create a separate sub for the status bar and send all my
variables from many loops in my main module to one single status bar
routine.

So if I send the variables to status routine, I can calculate a %
completed stat. But depending on the loop that I am analyzing, I may
want to have different texct associated with the status report.
Example:

25% Completed Loop 1
55% Completed Loop 2
70% Completed Loop 3

My question is, how do I change the text after the calc now that the
status bar is in its own sub? I almost need a Case Stmt within the
statusbar sub that decides what text to use based on where the
variables came from. That is append "Completed Loop 1" if varibles
come from part X of routine etc

Or is it possible to Call the routine and append the text to the call
statement?

Call StatusBar & "Completed Loop 1"


---
Message posted from http://www.ExcelForum.com/




Tom Ogilvy

Dynamic Status Bar Routine
 
Sub WriteToStatusBar( sStr as String, sStr1 as String)
application.StatusBar = sStr & " Completed " & sStr1
End Sub



in another routine
WriteToStatusBar "25%", "1"

or
Dim sV1 as String, sV2 as String
sV1 = "25%"
sV2 = "1"

WriteToStatusBar sV1, sV2
--
Regards,
Tom Ogilvy


"ExcelMonkey " wrote in message
...
I normally use status bars with my loops for progress indicators. I
would like to create a separate sub for the status bar and send all my
variables from many loops in my main module to one single status bar
routine.

So if I send the variables to status routine, I can calculate a %
completed stat. But depending on the loop that I am analyzing, I may
want to have different texct associated with the status report.
Example:

25% Completed Loop 1
55% Completed Loop 2
70% Completed Loop 3

My question is, how do I change the text after the calc now that the
status bar is in its own sub? I almost need a Case Stmt within the
statusbar sub that decides what text to use based on where the
variables came from. That is append "Completed Loop 1" if varibles
come from part X of routine etc

Or is it possible to Call the routine and append the text to the call
statement?

Call StatusBar & "Completed Loop 1"


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 12:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com