Timer

S

Steve R

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!
 
H

Helen Trim

Try this:

Dim Start As Date, Finish As Date

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

HTH
Helen
 
S

sr

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
 
D

Dick Kusleika

sr

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