Hi
I have the below data i only want to capture the time of those task which is yes in column B.
<tbody>
</tbody>
I have the below code please could some one assist me in creating a if statement wherin i could capture time of only those task which have yes in column B
Option Explicit Sub StartWatch() ' store time in start column Dim rngTemp As Range Set rngTemp = ActiveSheet.Range("C" & Rows.Count).End(xlUp).Offset(1, 0) rngTemp = Now() End Sub Sub StopWatch() ' store time in stop column ' copy previous formula down Dim rngTemp As Range Set rngTemp = ActiveSheet.Range("D" & Rows.Count).End(xlUp).Offset(1, 0) rngTemp = Now() If rngTemp.Row <> 2 Then rngTemp.Offset(-1, 1).AutoFill Destination:=Range(rngTemp.Offset(-1, 1), rngTemp.Offset(0, 1)), Type:=xlFillDefault Range("D65536").End(xlUp).Offset(1, 0).Select Else rngTemp.Offset(, 1).Formula = "=$D2-$C2" End If End Sub</pre>
I have the below data i only want to capture the time of those task which is yes in column B.
Column A | Column B | Column C | Column D |
START TIME | END TIME | ||
TASK A | |||
TASK B | yes | ||
TASK C |
<tbody>
</tbody>
I have the below code please could some one assist me in creating a if statement wherin i could capture time of only those task which have yes in column B
Option Explicit Sub StartWatch() ' store time in start column Dim rngTemp As Range Set rngTemp = ActiveSheet.Range("C" & Rows.Count).End(xlUp).Offset(1, 0) rngTemp = Now() End Sub Sub StopWatch() ' store time in stop column ' copy previous formula down Dim rngTemp As Range Set rngTemp = ActiveSheet.Range("D" & Rows.Count).End(xlUp).Offset(1, 0) rngTemp = Now() If rngTemp.Row <> 2 Then rngTemp.Offset(-1, 1).AutoFill Destination:=Range(rngTemp.Offset(-1, 1), rngTemp.Offset(0, 1)), Type:=xlFillDefault Range("D65536").End(xlUp).Offset(1, 0).Select Else rngTemp.Offset(, 1).Formula = "=$D2-$C2" End If End Sub</pre>