ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Timer (https://www.excelbanter.com/excel-programming/284431-timer.html)

Steve R[_2_]

Timer
 
Any way to have the time it takes to run a procedure
appear somewhere? Perhaps on the status bar?

Start = Timer
Finish = Timer
Application.StatusBar = TotalTime = Finish - Start




TIA!

Helen Trim[_4_]

Timer
 

Try this:

Dim Start As Date, Finish As Date

Start = Now
' Procedure
Finish = Now
Application.StatusBar = "Time taken=" & Format((finish -
Start), "ss")

HTH
Helen

sr

Timer
 
Thanks for the response. Unfortunately, I get a syntax
error for the code for the last line below..........


Dim Start As Date, Finish As Date
Start = Now

Range("br3").Select
Application.ScreenUpdating = False
While ActiveCell < ""

If ActiveCell + ActiveCell.Offset(0, 1) < 1 Then
ActiveCell.EntireRow.Delete
ActiveCell.Offset(-1, 0).Select
End If
ActiveCell.Offset(1, 0).Select
Wend
Application.ScreenUpdating = True
Finish = Now

************Syntax Error***********
Application.StatusBar = "Time taken=" & Format((Finish -
Start), "ss")



End Sub





-----Original Message-----

Try this:

Dim Start As Date, Finish As Date

Start = Now
' Procedure
Finish = Now
Application.StatusBar = "Time taken=" & Format((finish -
Start), "ss")

HTH
Helen
.


Dick Kusleika[_3_]

Timer
 
sr

The syntax is correct. The two lines under your error should be one line.
They probably got wrapped in the message.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"sr" wrote in message
...
Thanks for the response. Unfortunately, I get a syntax
error for the code for the last line below..........


Dim Start As Date, Finish As Date
Start = Now

Range("br3").Select
Application.ScreenUpdating = False
While ActiveCell < ""

If ActiveCell + ActiveCell.Offset(0, 1) < 1 Then
ActiveCell.EntireRow.Delete
ActiveCell.Offset(-1, 0).Select
End If
ActiveCell.Offset(1, 0).Select
Wend
Application.ScreenUpdating = True
Finish = Now

************Syntax Error***********
Application.StatusBar = "Time taken=" & Format((Finish -
Start), "ss")



End Sub





-----Original Message-----

Try this:

Dim Start As Date, Finish As Date

Start = Now
' Procedure
Finish = Now
Application.StatusBar = "Time taken=" & Format((finish -
Start), "ss")

HTH
Helen
.





All times are GMT +1. The time now is 01:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com