|
楼主 |
发表于 2024-8-25 04:10
|
显示全部楼层
If Format(t, "h:m:s") < #1:00:00 AM# Then
- Sub LLL()
- Dim Rng As Range, oRng As Range
- Dim Sht As Worksheet
- Dim ii, jj
- Set Sht = Sheet2
- Set Rng = Sht.Cells(10, 1).CurrentRegion
- Debug.Print Rng.Address
-
- With Sht
- .Cells.Font.Size = 9
- For ii = 1 To Rng.Rows.Count
- Set oRng = Rng(ii, 1)
- t = .Cells(oRng.Row + oRng.Rows.Count - 1, 1) - .Cells(Rng.Row, 1)
-
- Debug.Print Format(t, "h:m:s"), Format(t, "h:m:s") < #1:00:00 AM#
-
- If Format(t, "h:m:s") < #1:00:00 AM# Then
- .Cells(ii + 4, "C") = "= text(" & .Cells(oRng.Row + oRng.Rows.Count - 1, 1).Address & "-" & .Cells(Rng.Row, 1).Address & ", " & """m分:s秒"")"
- .Cells(ii + 4, "E") = "=" & """" & .Name & ii & ",用时""" & " & text(" & .Cells(oRng.Row + oRng.Rows.Count - 1, 1).Address & "-" & .Cells(Rng.Row, 1).Address & ", " & """m分:s秒"")"
- Else
- .Cells(ii + 4, "C") = "= text(" & .Cells(oRng.Row + oRng.Rows.Count - 1, 1).Address & "-" & .Cells(Rng.Row, 1).Address & ", " & """h小时:m分"")"
- .Cells(ii + 4, "E") = "=" & """" & .Name & ii & ",用时""" & " & text(" & .Cells(oRng.Row + oRng.Rows.Count - 1, 1).Address & "-" & .Cells(Rng.Row, 1).Address & ", " & """h小时:m分"")"
-
- End If
- Next ii
- End With
- End Sub
复制代码
|
|