Active Member
March 9, 2020
Hi,
I would like to use a timer to run concurrently with a macro to complete a lengthy process matching information then creating and pdf-ing brochures.
But I would like the macro to activate and stop the timer automatically - not manually use command buttons.
When I try using the Timer code you published at the start of the macro it dominates the macro and won't allow the following processes to run.
Is there a way around this?? Your assistance would be appreciated.
October 5, 2010
Hi Mike,
Without seeing your code it's hard to say. Are you using DoEvents?
An alternative approach is to just take a timestamp when your macro starts and another when it ends then work out the elapsed time. Do you need to see elapsed time in real-time or just see how long the code took once it's finished?
Regards
Phil
Active Member
March 9, 2020
Hi Phil,
I was using DoEvents, but without success.
I have gone to your idea of Time Stamping .. as I'm only interested in the net time, not the running time.
BUT .. I have unprotected the cells for the start and finish time stamps and protected the sheet.
Now the macro pulls up an 'Unable to set the NumberFormat property of the range class' even though the formatting of the respective cells corresponds with the time stamp format. I don't get this error is the sheet is not protected.
Any suggestions?
October 5, 2010
Hi Mike,
Without seeing your code I can only guess as to what you are doing.
But if you use this Sub then you should be able to work out the time it takes some code to run
Sub MyTimer()
Dim Start As Single, RunTime As Single
Dim ElapsedTime As String
Start = Timer
' Your code goes here
ElapsedTime = Format((Timer - Start) / 86400, "hh:mm:ss")
End Sub
Regards
Phil
Active Member
March 9, 2020
Hi Phil,
After much playing around I've decided to dump the idea as I couldn't get any scenario to work satisfactorily.
The Workbooks I've created are 41mb and 57mb, and formula intense.
What I've found (apart from not getting any to work in a Protected Sheet) was that the timer would trigger the calculate function.
This normally wouldn't be an issue, however it was forcing the whole spreadsheet to re-calc, a time consuming process that would be triggered regularly by the timer.
I intend to try and market these spreadsheets as they are perculiar to the building industry and need to be a protected worksheets.
So, thanks for your help all the same, I'm sure I'll trip over another problem that will need your expertise :).
Regards,
Mike
October 5, 2010
Hi Mike,
Running the MyTimer code above shouldn't trigger calculation. hmmmm.
Not knowing what you are doing in these workbooks, but judging by the size, perhaps storing your data in a SQL database and using Power Query or Power BI might be an option for you?
But, I don't know what you are trying to do so they are just suggestions.
Regards
Phil
Active Member
March 9, 2020
Hi Phil,
The whole exercise revolves around matching land with house designs. An exercise generally performed between Sales, the Estimator and the Draftsman.
My concept combines all the activities into the two spreadsheets, where the uninitiated can simply input basic information and the program determines the parameters for each lot then matches them with the parameters for each design, taking into account council or individual subdivision requirements. The net result is it produces a price for a house-land package and marries this with a preformatted brochure. The resulting pdf is automatically filed according to a predetermined folder set up.
Sound simple, but it is an extensive filtering process that changes with lot width, depth, design, subdivision, etc, etc. I considered creating this in a database, but the conditional statements would be unworkable. I've even split some formula into two or three so I can follow and correct them. Spreadsheets give you 'room to move' so to speak.
I've got it completed now. My recent test had the program creating just over a 1,000 different pdf brochures in less than an hour. The timer was to give the user an idea of how long each of the several different brochure types they want take to produce. Once they've seen the program run once they have an idea of how long to leave it alone and go on with something else.
Regards,
Mike
1 Guest(s)