小弟VB刚开始学,写了一个代码如下:Sub DailyWorkAssignment()Dim x As Integer
Dim n As Integer
Dim D As DateActiveSheet.UsedRange.Select
Selection.UnMergex = Range("A65536").End(xlUp).Row
D = InputBox("Enter the Date")For n = 1 To x If Cells(n, 1) = "" Then
Cells(n, 1).EntireRow.Delete
ElseIf Cells(n, 5).Value <= D Then
Cells(n, 5).EntireRow.Delete
End If
Next nCells.Select
Cells.EntireColumn.AutoFit
Cells.EntireRow.AutoFitEnd Sub但是每次运行,都不能把制定日期之前的记录删除掉,请高手指点一下,小弟多谢了
Dim n As Integer
Dim D As DateActiveSheet.UsedRange.Select
Selection.UnMergex = Range("A65536").End(xlUp).Row
D = InputBox("Enter the Date")For n = 1 To x If Cells(n, 1) = "" Then
Cells(n, 1).EntireRow.Delete
ElseIf Cells(n, 5).Value <= D Then
Cells(n, 5).EntireRow.Delete
End If
Next nCells.Select
Cells.EntireColumn.AutoFit
Cells.EntireRow.AutoFitEnd Sub但是每次运行,都不能把制定日期之前的记录删除掉,请高手指点一下,小弟多谢了
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货