VBA Code to Delete Blank Columns in Excel

This code deletes all the blank columns in the active worksheet.

VBA Code:

Sub DeleteBlankColumns()
    Dim rng As Range
    Dim i As Long
    Set rng = ActiveSheet.UsedRange
    For i = rng.Columns.Count To 1 Step -1
        If WorksheetFunction.CountA(rng.Columns(i)) = 0 Then
        End If
    Next i
End Sub

Check All VBA Codes

Join Our Telegram Group techguruplus telegram group Join Our WhatsApp Group techguruplus whatsapp group

Leave a Comment