|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub 按钮1_Click()
Set fso = CreateObject("scripting.filesystemobject")
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each f In fso.getfolder(ThisWorkbook.Path).Files
If InStr(f.Name, ThisWorkbook.Name) = 0 Then
With Workbooks.Open(f)
Set Rng = Nothing
With .Sheets(1)
r = .Cells(Rows.Count, 1).End(3).Row
arr = .[a1].Resize(r)
For J = 2 To UBound(arr)
dt = CDate(Left(arr(J, 1), 4) & "-" & Mid(arr(J, 1), 5, 2) & "-" & Right(arr(J, 1), 2))
If Month(dt) = Month(dt + 1) Then
If Rng Is Nothing Then
Set Rng = .Cells(J, 1)
Else
Set Rng = Union(Rng, .Cells(J, 1))
End If
End If
Next J
If Not Rng Is Nothing Then Rng.EntireRow.Delete
End With
.Save
.Close True
End With
End If
Next f
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
|
评分
-
1
查看全部评分
-
|