TIME LINE IN EXCEL

Asked By Sathish Kumar
26-Jan-10 04:32 AM
Earn up to 0 extra points for answering this tough question.

hi,

I am using Excel 2003. I want to create a time line in the header of the Excel spreadsheet where when i click start it should run and display the time and when it crosses 2 mins it should highlight in red colour so that the user can identify that he crossed 2 mins and when i click stop it should display the time consumed.

Can anyone help me with this.

Thanks in Advance.

Sathish

  RE: TIME LINE IN EXCEL

Jonathan VH replied to Sathish Kumar
26-Jan-10 06:55 AM

Do you mean a timer (and not a "time line")?

What do you mean when you write "header?"

  RE: TIME LINE IN EXCEL

Sathish Kumar replied to Jonathan VH
26-Jan-10 07:57 AM

Hi Jonathan

Actually i am doing a work in Excel which needs monitoring the time consumption. It can be a Timer or a Time LIne . Time limit for the job is 2 mins so if it exceeds 2 mins i want some change in the Timer to indicate the time is crossing the limit.

header means nothing but top of the excel spreadsheet

  RE: RE: TIME LINE IN EXCEL

Jonathan VH replied to Sathish Kumar
26-Jan-10 08:51 AM

I guess you want something like this:

Option Explicit
Dim stopped As Boolean

Sub TimerStart()
  Dim start As Integer
  stopped = False
  start = CInt(Timer)
  With Range("B1").FormatConditions
    .Delete
    .Add Type:=xlCellValue, Operator:=xlGreaterEqual, Formula1:="120"
    .Parent.FormatConditions(1).Interior.ColorIndex = 3
  End With
  While Not stopped
    If start <> CInt(Timer) Then Range("B1") = CInt(Timer) - start
    DoEvents
  Wend
End Sub

Sub TimerStop()
  stopped = True
End Sub

Use TimerStart as the macro for your first button, and TimerStop as the macro for the second button.  If you're using OLE button object (rather than form objects), use the code in the CommandButtonX_Click events.

  RE: RE: TIME LINE IN EXCEL
Sathish Kumar replied to Jonathan VH
27-Jan-10 07:54 AM

Hi Joathan,

I am getting an error in

start = CInt(Timer)

 

  re: RE: RE: TIME LINE IN EXCEL
Manish Mishra replied to Sathish Kumar
01-Feb-10 08:51 AM

Hi Satish,

remove the CInt from the code and

declare the "Dim Start as Double"

would solve the problem. Hope tht works.

 

Regards

Manish

Create New Account