delete columns with excel vba

  • Hi all,


    I have used some code to delete columns. If I do it with the mouse, and then select the right mouse button (having the mouse in the column letter), it will delete all (even when there is columns with a color fill and formating).


    How can this be done using code?


    this will not work:

    Code
    Sub Delete_EntireColumn()
    Columns(1).EntireColumn.Delete
    End Sub


    Greetings.

  • Re: delete columns with excel vba


    As per your description if you delete a column say Column A by right clicking the column letter and choose delete, you can perform the similar action with


    Columns("A").Delete
    OR
    Columns(1).Delete

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!