I am new to UserForms and clocks/timers and am having trouble coming to grips with them. I have searched high and low on the internet but I can’t find exactly what I am after and I don’t know enough to modify what I have found to suit my purpose. I seem to have found everything but what I am after. Any help would be much appreciated.
I want to do 2 things.
Firstly, I want to display a TIMER in a UserForm. The timer would start as soon as the user presses a button which copies a formula down to the end of column of data.
The timer would be displayed until Excel finishes calculating and then it would disappear.
The code to copy the formula down is just a few lines, but 99.9% of the time the macro takes to complete is due to the time it takes Excel to calculate/re-calculate.
Secondly, I want to display a progress bar which updates as the time elapses.
I have found progress bars which update based on a repetitive loop – e.g. entering random numbers in a specified number of rows and columns, but I can’t work out:
1. How to make a progress bar update based on time elapsed. I know how long the macro takes to run on average, so that would essentially be 100%; and
2. How to get it to update while Excel is calculating. During this time it just freezes.
The attached file contains a small sample of my data. The full source data file is >200K rows and takes about 25 minutes to run/calculate which is why I want a timer and progress bar.
It contains a standard VBA module to copy and paste a formula down to the end of column of data.
I don’t know if it helps, but I have included a UserForm for a progress bar, but it is based on a repetitive loop that inserts random numbers. I want to modify this to be based on time. On my PC, the macro takes about 24 seconds to run and for Excel to finish calculating.
I haven’t included a UserForm for a Timer.
In order to get the timer and progress bar to update while Excel is calculating, I am not sure whether the UserForm needs to call the macro in the standard VBA module or vice versa. I’m very confused.
Thanks for taking the time to read this. If you can help, I would be most grateful.
Many thanks
David ExcelForum Sample File - Timer & Progress Bar.xlsm
Bookmarks