VBA减去两个日期

时间:2020-05-12 13:07:31

标签: excel vba

我遇到了这个问题,我想从自己身上减去两个日期,但是我仍然遇到运行时错误13,类型错误 任务是从今天的单元格(单元格格式:日期)中减去日期。我可以用今天的日期创建一个单元格,但我不愿意。

.status:before {
  content: "";
  position: absolute;
  width: 100%;
  height: 4px;
  bottom: 100%;
  left: 0;
  background-color: #3e70ff;
}
.swiper-slide:first-of-type .status:before {
  width: 50%;
  left: 50%;
}
.swiper-slide:last-of-type .status:before {
  width: 50%;
}

1 个答案:

答案 0 :(得分:0)

使用CDate可能会解决您的问题,请尝试:

Dim i As Long, j As Long
Dim ark5 As Worksheet
Set ark5 = Worksheets("Zalegle")
Dim LastRow5 As Long
Dim a As Date


LastRow5 = ark5.Cells(Rows.Count, 2).End(xlUp).Row
a = DateDiff("d", Now, CDate(ark5.Cells(2, "G").value))

For i = LastRow5 To 2 Step (-1)
    If Date - a < 7 Then
        Rows(i).EntireRow.Delete
    End If
Next i

End Sub```
相关问题