Thread: increment time
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Matt S Matt S is offline
external usenet poster
 
Posts: 112
Default increment time

This is what I've come up with below. Any suggestions?

Dim LastRow As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row

Range("G1").FormulaR1C1 = "=MID(R6C1,12,8)"
Range("G2").FormulaR1C1 = "=MID(R1C7,8,1)"
Range("G3").FormulaR1C1 = Range("G2") + 1
Range("G4").FormulaR1C1 = Mid(Range("G1"), 1, 7) & Range("G3").Value
Range("A8").Value = Range("G1").Value
Range("A9").Value = Range("G4").Value
Range("A8:A9").NumberFormat = "[$-F400]h:mm:ss AM/PM"
Range("A8:A9").AutoFill Destination:=Range("A8:A" & LastRow)
Range("G1:G4").Clear


"Matt S" wrote:

hi,

I'm trying to write a macro and got stuck trying to increment my time value.

Cell A6 has the following information for when I started my test:
Sun Jun 22 14:33:37 2008 (GMT-04:00)
Then A8 starts at zero, A9 = 1, A10=2, etc.

What I'd like to do is replace A8 with the time from A6 and then increment
the time by one second downward in the same format.

I know I can get the time stamp for A8 using the MID function, which I
successfully have done, but how do I make the next line increment the time?

Thanks so much!
Matt