Joh*_*ton 1 excel vba excel-vba
我在excel上有一个csv文件,该列为~CU.
并且行保持更新(截至目前为2606).
我试着
before today's dateD列上记录的所有行Sub deleterows()
lastrow = Cells(Rows.Count, 4).End(xlUp).Row
For i = lastrow To 2 Step -1
If Cells(i, 4).Value < *numeric value* Then Rows(i).EntireRow.Delete
Next i
End Sub
Run Code Online (Sandbox Code Playgroud)
对于日期(和货币),始终建议使用Value2而不是Value.
MSDN:
此属性与Value属性之间的唯一区别是Value2属性不使用Currency和Date数据类型.您可以使用Double数据类型将使用这些数据类型格式化的值作为浮点数返回.
所以你需要做的就是改变这一部分 If Cells(i, 4).Value < *numeric value* Then
有了这个 If Cells(i, 4).Value2 < Date Then
如果D列比今天旧,则评估为真.
| 归档时间: |
|
| 查看次数: |
2370 次 |
| 最近记录: |