• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

delete entire columns

Sanussha

New Member
Hi all, i would like to know how to delete entire column including the header if the cells until last row column is empty. In this attached book 1, i have mention number on the header example; 2504, 2505, 2506, 2507 & 2508. I would like to delete entire rows including number 2505, 2507 and 2508 due to there is no data until the end of the last row columns. Thanks in advance ;-)
 

Attachments

  • Book 1 .xlsx
    45.2 KB · Views: 3
Hi, according to your attachment a VBA demonstration for starters :​
Code:
Sub Demo1()
    Dim C%
        C = Cells(Columns.Count).End(xlToLeft).Column
    With Application
        .ScreenUpdating = False
    While C > 1
        If .Count(ActiveSheet.UsedRange.Columns(C)) = 1 Then Columns(C).Delete
        C = Cells(C).End(xlToLeft).Column
    Wend
        .ScreenUpdating = True
    End With
End Sub
Do you like it ? So thanks to click on bottom right Like !
 
Hi Marc,

The VBA code you provided doesn't worked. It doesn't delete any of my blank columns with no header and blank columns with the header.

Could you please have a look?
 
Back
Top