Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Using a progress bar while running a routine

Posted on 2011-03-10
6
Medium Priority
?
788 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 23

Accepted Solution

by:
Michael Fowler earned 375 total points
ID: 35099759
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 375 total points
ID: 35099761
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 42

Assisted Solution

by:dlmille
dlmille earned 375 total points
ID: 35099911
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 45

Assisted Solution

by:patrickab
patrickab earned 375 total points
ID: 35115588
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
ID: 35192484
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
ID: 35193725
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

730 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