Xóa tất cả những Sheet trống trong Excel cùng một lúc

Nếu làm việc với file Excel mà có nhiều Sheet trống , để xoá tất cả những Sheet trống cùng một lúc

bạn cần tạo Macro với nội dung bên dưới rồi chạy nó .

 

Sub DeleteBlankWorksheets()

Dim Ws As Worksheet

On Error Resume Next

Application.ScreenUpdating = False

Application.DisplayAlerts = False

For Each Ws In Application.Worksheets

    If Application.WorksheetFunction.CountA(Ws.UsedRange) = 0 Then

        Ws.Delete

    End If

Next

Application.ScreenUpdating = True

Application.DisplayAlerts = True

End Sub