答案 0 :(得分:0)
您可以使用此功能,您可能需要根据需要修改wb和ws。
Sub mysub()
Dim wb As Workbook
Dim ws As Worksheet
Set wb As ActiveWorkbook
Set ws As wb.Sheets("Sheet1")
ws.Range("G4:G1000").Formula = "=IF(A4="Ended OK","Completed",IF(A4="Executing","In progress",IF(D4=1,ROUND(((NOW()-1)-(B4+E4))*24,0),ROUND(((NOW())-(B4+E4))*24,0))))"
End Sub