Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

userform status

Status
Not open for further replies.

andrew299

Technical User
Nov 18, 2002
140
GB
Hello again
I want to create a sort of status bar for my macro. I have the code that calculates the percentage complete but how do I display this?
I thought first of all about msgboxes but dont want to click OK everytime (could be 400 times +).
So I thought ahh! userforms - created one that displays without OK by using labels but still have to click the x.
Then I looked in the FAQs and found that I could turn off the x - so I did. But now there is no way of removing the userform and therefore the progrma wont run further.
Any ideas as to how i can just have a display box that updates with every cycle of the loop?

Thanks
Andrew299
 
Using a userform with a single label is definitely the easiest way to go. How to do it depends on which version of Excel (I'm assuming?) you are running - if it's 2000 or better, you can use a modeless userform, which stays up while your code keeps on running:

frmProgress.show vbModeless
do
...do your stuff here
...calculate %completion
frmProgress.lblProgress= MyProgressPct & "% completed"
loop until done
unload frmProgress

You can make it a little fancier by using the progressbar control, which shows the typical progress bar we all know and love. You can select it as an "additional control" by right-clicking on the controls toolbox in VBE - I think it's name is Microsoft Progress Bar Control, or something similar.
Rob
[flowerface]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top