VBA - Excel: Display a Counter
Wire Less
-
tompols Posted messages 1273 Registration date Status Contributor Last intervention -
tompols Posted messages 1273 Registration date Status Contributor Last intervention -
Hello everyone.
I have a program that takes quite a long time to execute, with lots of loops processing lots of data.
Since it takes a while, I would like to use a counter. I understand that the best way to do this is to use a "userform". Okay, I can do that.
My problem comes from ---- Application.ScreenUpdating = False ----- that I use (to avoid having an epileptic fit with all the flashing windows!!)
As a result, I can't see my userform getting updated!
Has anyone encountered this kind of problem? And above all, does anyone have a solution??
Thank you
I have a program that takes quite a long time to execute, with lots of loops processing lots of data.
Since it takes a while, I would like to use a counter. I understand that the best way to do this is to use a "userform". Okay, I can do that.
My problem comes from ---- Application.ScreenUpdating = False ----- that I use (to avoid having an epileptic fit with all the flashing windows!!)
As a result, I can't see my userform getting updated!
Has anyone encountered this kind of problem? And above all, does anyone have a solution??
Thank you
Configuration: Windows 2000 Firefox 3.0.13
2 answers
Hello,
Application.screenupdating does not apply to userforms.
To add the progress bar control, right-click on the Controls tab of the toolbox, then select Additional Controls and check the Microsoft ProgressBar Control x.x
Then the idea is to increment the value of the progress bar from 1 to 100 in a loop based on the percentage of the macro's progress (this is where it can get a bit tricky depending on your code)
--
By a beautiful solution, we mean the simple and easy solution to a difficult and complicated problem.
Application.screenupdating does not apply to userforms.
To add the progress bar control, right-click on the Controls tab of the toolbox, then select Additional Controls and check the Microsoft ProgressBar Control x.x
Then the idea is to increment the value of the progress bar from 1 to 100 in a loop based on the percentage of the macro's progress (this is where it can get a bit tricky depending on your code)
--
By a beautiful solution, we mean the simple and easy solution to a difficult and complicated problem.
non non, simply by incrementing its value from 1 to 100 (or modifying its max value property to 1000) in your procedure:
--
By a nice solution, we mean the simple and easy solution to a difficult and complicated problem
Sub Toto For i = 1 to 1000 Moulinette_1 Moulinette_2 UserForm1.ProgressBar1 = i / 10 'assuming that the max value of ProgressBar1 is set to 100 (by default) Next End Sub
--
By a nice solution, we mean the simple and easy solution to a difficult and complicated problem
Sub Toto
For i = 1 to 1000
Moulinette_1
Moulinette_2
...
Next
End Sub
I need to put something like
Private Sub ProgressBar1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As stdole.OLE_XPOS_PIXELS, ByVal y As stdole.OLE_YPOS_PIXELS)
End Sub
Somewhere? Is that it?