VBA progress indicator multiple subs

Robertvk

Board Regular
Joined
Oct 15, 2015
Messages
121
Hello,

Im trying to create a progress indicator for a lengthy macro code. I've used this tutorial te recreate a progress bar:
HTML:
http://www.excel-easy.com/vba/examples/progress-indicator.html

However, this tutorial assumes you want to rerun the same code over and over again until the loop is done.

What I want is something like this:

1. Start sub step1
2. Show progress @ 10%
3. Call sub step2
4. Show progress @ 20%
5. Call sub step 3
6. Show progress @ 30%
7. Halfway sub step 3, Show progress @ 35%, continue at the line last executed in sub 3
8. Show progress @ 40%
9. Call sub step 4

etc. etc.


This is the current code of the progress bar.
Code:
Sub Progress(sinPro As Single, strPro As String)

UserForm1.Text.Caption = strPro
UserForm1.Bar.Width = (sinPro / 11) * 200
DoEvents

End Sub

I was thinking of working with GoTo commands but perhaps there is a more elegant solution.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Nevermind, got it:


Code:
With UserForm1
    .StartUpPosition = 0
    .Left = Application.Left + (0.5 * Application.Width) - (0.5 * .Width)
    .Top = Application.Top + (0.5 * Application.Height) - (0.5 * .Height)
    .Show [B]False[/B]
End With


Close the userform with:

Code:
UserForm1.Hide
 
Upvote 0

Forum statistics

Threads
1,216,756
Messages
6,132,534
Members
449,733
Latest member
Nameless_

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top