How to use rectangle as progress bar

ashni

New Member
Joined
Jun 13, 2016
Messages
32
Can i Use rectangle shape as a progress bar showing progress of my work.
I don't want to use cells as progress bar as my application has the requirement that the shape should move from column to column.
I want to do it using macro.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Sure, I used a UserForm named frmBar that popped up and expanded a label and updated the Form's Caption to show the %. I've cut all the code that does what I was using it for. this just shows the updating procedure.

lRow = current row
lTotalRows = total number of rows I am looping through
iPct = Percentage of rows I have done so far

Code:
Sub PerformUpdate()
    For lRow = 2 To lTotalRows            
         iPct = Round(lRow /lTotalRows* 100)'Divide current Row by total rows
         UpdateProgress iPct
    Next lRow
End Sub

The 'UpdateProgress' Procedure looks like this

Code:
Private Sub UpdateProgress(iPct As Integer)'update to progress bar form with the current % completed

    frmBar.frame_Bar.Caption = frmBar.sProcedure & " - " & iPct & "% Complete"
    frmBar.lblBar.Width = iPct * 2 'expands the bar by 2 points every %
    
    DoEvents
End Sub

If using a UserForm ensure you call the 'PerformUpdate' procedure from within the form

The UpdateProgress was stored in a module

Hope this helps, there are several tutorials on creating a progress bar in VBA just Google them
 
Upvote 0

Forum statistics

Threads
1,215,326
Messages
6,124,270
Members
449,149
Latest member
mwdbActuary

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