批量删除多个相同格式内容的Excel表格的列Sub Del_Col()
Application.DisplayAlerts = False
Dim myFiles As String
Dim myExcels As String
With Application.FileDialog(msoFileDialogFolderPicker)
.Show
.AllowMultiSelect = False
.Title = "请选择要删除列的⽂件所在⽂件夹"
myFiles = .SelectedItems(1)
End With
myExcels = Dir(myFiles & "\" & "*.xls*")
delete删除表格还是内容Do While Len(myExcels) <> 0
Workbooks.Open (myFiles & "\" & myExcels)
Worksheets(1).Columns("H:H").Delete
Worksheets(1).Columns("F:F").Delete
Worksheets(1).Columns("E:E").Delete
Worksheets(1).Columns("C:C").Delete
Worksheets(1).Columns("B:B").Delete
ActiveWorkbook.Save
Workbooks(2).Close
myExcels = Dir
Loop
Application.DisplayAlerts = True
MsgBox "删除完成"
End Sub
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论