I have this WB, how to autofill formula to D:G range til the time stamp is same as cell J1
Printable View
I have this WB, how to autofill formula to D:G range til the time stamp is same as cell J1
Hi
In I1,
=MATCH(J1-INT(J1),C4:C47)
In H1, type 1. To stop macro type 0 in H1
Code:Sub StartMacro()
Dim r, t As Date, i As Long
t = Now() + TimeSerial(0, 0, 5)
Application.OnTime t, "StartMacro", , True
r = [i1]
i = [h1]
If Not i = 0 Then
If Not IsError(r) Then
Range("d4:h4").AutoFill Range("d4:h4").Resize(r)
End If
Else
Debug.Print Now
Application.OnTime t, "StartMacro", , False
End If
End Sub
I can't get it to work, I1 show #N/A when i run the macro, can use macro button to run and stop the macro?
Admin, I think i found the problem, in the time column i am using some formula to get the time, how to add the code to change the time formula to value in your code? when the value of time format is m/dd/yyyy h:mm:ss AM/PM I1 show #N/A, but when i change the time format to h:mm:ss AM/PM, it is good,
modify your formula like
=YourOriginalFormula-INT(YourOriginalFormula)
And format the cell as time