SOLVED

Progress bar while running macro

Brass Contributor

Hi ,

 

here attached my macro. i need to hide things happening while running macro and need to display progress bar till complete the macro. 

can anyone help me to do this

3 Replies

@Ravindu94 

To toggle screen updating off and on during execution, insert Application.Screenupdating = False of Application.Screenupdating = True in your code where needed.

 

To display progress, and provided you have some kind of counter (e.g. Step .... of 5000), you could use something like Application.Statusbar = "Step " & counter & " of 5000 completed"

 

@Riny_van_Eekelen 

 

Hi Riny,

thank you for your respond. i need to show some visual showing by user form function. here attached with my macro. can you please help to do this for my excel please

best response confirmed by Ravindu94 (Brass Contributor)
Solution

@Ravindu94 Had a quick look at your set of macros. I suspect that many of them are straight recordings without any clean-up performed. I notice numerous unnecessary scroll commands, select something, do nothing, select something else, format something and then format the same selection again etc. It really needs cleaning-up. Can't really test any of it, as you link to files on your own system.

 

The button on your first sheet starts up a sub called "CommandButton1_Click()". I've inserted the code I suggested in my previous post. You'll need to copy the Statusbar piece before each of the following calls and increase the step number by one (I've done two for you). Note that the Statusbar gives visual feedback in the bottom left-hand side of the screen.

Private Sub CommandButton1_Click()

Application.Screenupdating = False

GetFile1

Application.Statusbar = "Step 1 of 22 completed"

Macro1

Application.Statusbar = "Step 2 of 22 completed"

GetFile2
Macro2
Macro3
DeleteBlankRows
Macro4
Macro5
Macro6
Macro7
Macro8
Macro10
Macro11
GetFile2
Macronext1
Macronext2
Macronext3
Macro1next
Macro2next
Macro3next
Macro4next
summery

Application.Screenupdating = True

End Sub

If you insist on using a UserForm, use Google to find detailed instructions. It's not something I'm familiar with. Sorry!

1 best response

Accepted Solutions
best response confirmed by Ravindu94 (Brass Contributor)
Solution

@Ravindu94 Had a quick look at your set of macros. I suspect that many of them are straight recordings without any clean-up performed. I notice numerous unnecessary scroll commands, select something, do nothing, select something else, format something and then format the same selection again etc. It really needs cleaning-up. Can't really test any of it, as you link to files on your own system.

 

The button on your first sheet starts up a sub called "CommandButton1_Click()". I've inserted the code I suggested in my previous post. You'll need to copy the Statusbar piece before each of the following calls and increase the step number by one (I've done two for you). Note that the Statusbar gives visual feedback in the bottom left-hand side of the screen.

Private Sub CommandButton1_Click()

Application.Screenupdating = False

GetFile1

Application.Statusbar = "Step 1 of 22 completed"

Macro1

Application.Statusbar = "Step 2 of 22 completed"

GetFile2
Macro2
Macro3
DeleteBlankRows
Macro4
Macro5
Macro6
Macro7
Macro8
Macro10
Macro11
GetFile2
Macronext1
Macronext2
Macronext3
Macro1next
Macro2next
Macro3next
Macro4next
summery

Application.Screenupdating = True

End Sub

If you insist on using a UserForm, use Google to find detailed instructions. It's not something I'm familiar with. Sorry!

View solution in original post