|
这是我通过录制宏所得到的代码,d当我调试的时候总会报错----end if没有块if
请问是什么原因,应该如何修改,请指教,谢谢
Sub 删除()
myPath = ThisWorkbook.Path & "\"
MyName = Dir(myPath & "*.xls*")
Application.DisplayAlerts = False
Do While MyName <> ""
If MyName <> ThisWorkbook.Name Then
Set wb = Workbooks.Open(myPath & MyName)
With wb.Sheets(1)
Range("J:J,K:K,L:L").Delete
Range("K3:K19").Delete
Range("C3:C19").Select
With Selection.Font
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
End With
wb.Close True
End If
MyName = Dir
Loop
Set wb = Nothing
Application.DisplayAlerts = True
MsgBox "修改完成!"
End Sub
|
|