Solved

Using a progress bar while running a routine

Posted on 2011-03-10
6
739 Views
Last Modified: 2012-08-14
I have done some research in the Knowledgebase and found a number of articles on progress bars such as the link below.  I am having trouble figuring out how to call a routine and have a progress bar display while the macro performs such as the prgress bar that is in the link below.  I have a macro that creates a csv file, saves this to a specified folder, then logs into a secure ftp server and saves the file on the server, then ends the routine.  The process takes approximately 20 seconds, however this could vary depending on internet connection speeds.  So I am really looking for a progress bar that will actually track the progress of the macro, if this is possible.

http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/A_1756-A-VBA-Progress-Bar-for-Excel-and-Other-Microsoft-Apps.html?sfQueryTermInfo=1+10+30+excel+progressbar+vba

ID 1756
0
Comment
Question by:jlove88
6 Comments
 
LVL 23

Accepted Solution

by:
Michael74 earned 125 total points
Comment Utility
The example provided relies on you setting the minimum and maximum values. In fact all progress bars rely on a coded guess as to how long the code will run. If you do not want to use an educated guess then you could just use the status bar to show that code is running and then a messagebox to indicate that the code has completed.

Michael
0
 
LVL 22

Assisted Solution

by:rspahitz
rspahitz earned 125 total points
Comment Utility
Although there are some progress bar controls available for other things, there's nothing built in for Excel so you'll have to make your own (or load one from outside, which may require installing it if you share the workbook.)

What comes to mind is to open a UserForm with a simple label in it.  Inside the label you can add little pieces of text that represent the progress (like capital "i" or ".")
Every time you hit a certain point in the macro, you simply add another character to the label.
when you're done, you close the form from code.

Ideally, you will know how many times you'll hit the piece of code (like with a For/Next counter) or some other way to calculate the number of iterations so that you can put the right number of characters to fill the label when it completes.

Do you want to give this a try?
0
 
LVL 41

Assisted Solution

by:dlmille
dlmille earned 125 total points
Comment Utility
I use the status bar for my progress.  If I have a loop I'm working through, I can determine % complete.

Inside the loop, say every 20 or 100 loops, I update the statusbar...

e.g.,

 
Sub testwStatusBar()
Dim i As Double

    For i = 0 To 500000
     If i Mod 1000 = 0 Then
        Application.StatusBar = "Running... -> " & Format(i / 500000, "0.00%") & " complete..."
     End If
    Next i
    
    Application.StatusBar = False

End Sub

Open in new window


Dave
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 45

Assisted Solution

by:patrickab
patrickab earned 125 total points
Comment Utility
use the Status BAr to let you kno how th macro is progressing. it \doesn't interfere so much as a progress bar.

Patrick
0
 

Author Closing Comment

by:jlove88
Comment Utility
All comments were useful however after playing around with the ideas, I decided not to use a progress bar.  I think it fair to divide the points equally and thank you for responding.
0
 
LVL 45

Expert Comment

by:patrickab
Comment Utility
Points' divide is fine. A progress bar i good eye candy but thats' about all. stick with the Status bar and make it informative- that'll help a lot more
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Pivot help 3 21
Conditional format Excel Cell 3 14
Splitting out Data 14 26
Dynamic Vlookup Function Formula Help 4 11
Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now