VBA Projects

Full Access with Source Code
  • Designed and Developed by PNRao

  • Full Access with VBA Source Code

  • Well Commented Codes Lines

  • Creative and Professional Design

Manage Your Projects

120+ Project Management Templates

Seamlessly manage your projects with our powerful & multi-purpose templates for project management.

120+ PM Templates Includes:
  • 50+ Excel Templates

  • 50+ PowerPoint Templates

  • 25+ Word Templates

Share Post

VBA code to Delete multiple Columns example will help us to delete multiple Columns from excel worksheet. We can use Delete method of Columns to delete the multiple Columns. In this example we will see how to delete the multiple Columns in excel worksheet using VBA. VBA code for deleting multiple Columns macro should work for all the version of Microsoft Excel 2003, Excel 2007, Excel 2010, and Excel 2013.

VBA Delete multiple columns Excel Macro Example Code

VBA code to delete multiple Columns

Here is the Example VBA syntax and Example VBA Macro to delete multiple Columns from excel worksheets. This will help you to know how to delete specific and multiple Columns from Excel workbook using VBA.

VBA Delete multiple Columns: Syntax

Following is the VBA Syntax and sample VBA code to delete multiple Columns from worksheet using VBA. We are using the Delete method of the Columns object of worksheet.

[Column Names]").EntireColumn.Delete

Here Column Names are your Column Names to delete. And EntireColumn.Delete method will delete the Entire Columns from the Excel spreadsheet.

Delete multiple Columns using VBA: Examples

The following VBA code is to delete multiple Columns from the worksheet. This code will delete the multiple Columns (A to C) which we have mentioned in the code.

Sub sbVBS_To_Delete_Multiple_Columns ()
End Sub

Instructions to run the VBA code to delete multiple Columns

Please follow the below steps to execute the VBA code to delete multiple Columns from worksheets.
Step 1: Open any existing Excel workbook
Step 2: Press Alt+F11 – This will open the VBA Editor
Step 3: Insert a code module from then insert menu
Step 4: Copy the above code and paste in the code module which have inserted in the above step
Step 5: enter some sample data in Column A to E
Step 6: Now press F5 to execute the code

Now you can observe that the entire Columns from A to C are deleted from worksheet.

Explained VBA Code to Delete Multiple Columns:

Starting program and sub procedure to write VBA code to delete entire Column from sheet.

Sub sbVBS_To_Delete_Multiple_Columns_C()

‘Specifying the Columns to delete and Deleting the Columns using EntireColumn.Delete method.

End Sub
Ending the sub procedure to delete entire Column.

Here Columns(“A:C”) is to tell excel to delete Columns from A to C of the worksheet. And Delete method will delete the all specified Columns form the worksheet.

Delete Specific Multiple Columns using VBA: Examples

Here is the following VBA code is to delete specific multiple Columns from the worksheet. This code will delete the multiple specific Columns (A, C, H, K to O and Q to U) which we have mentioned in the code.

Sub sbVBS_To_Delete_Specific_Multiple_Columns()
End Sub

The above example delete the columns A, C, H, K to O and Q to U from the sheet named ‘Sheet1’.

Effortlessly Manage Your Projects and Resources
120+ Professional Project Management Templates!

A Powerful & Multi-purpose Templates for project management. Now seamlessly manage your projects, tasks, meetings, presentations, teams, customers, stakeholders and time. This page describes all the amazing new features and options that come with our premium templates.

Project Management Templates

All-in-One Pack
120+ Project Management Templates

Essential Pack
50+ PM Templates

Excel Pack
50+ Excel PM Templates

PowerPoint Pack
50+ Excel PM Templates

MS Word Pack
25+ Word PM Templates

Ultimate Project
Management Template
Ultimate Resource
Management Template
Project Portfolio
Management Templates
Categories: VBATags: Last Updated: June 17, 2022


  1. Shahid January 12, 2015 at 9:50 PM

    I tried this code, but it gives me an syntax error
    I do have data available from A to Z

    Can someone assist

  2. PNRao January 13, 2015 at 4:15 PM

    Hi Sahid,

    This code should work, please provide the code which you are testing:

    Columns("A:Z").EntireColumn.Delete ' this will delete the Columns A to Z
    'Or if you only want to clear the data
    Columns("A:Z").Clear ' this will clear the Columns A to Z


  3. Samantha August 1, 2015 at 1:02 AM

    Hi, I need to delete random columns (ex. A,C,G,H). I tried doing it like you explained with the multiple random rows but it didn’t work


  4. PNRao August 2, 2015 at 3:38 AM

    Hi Samantha,

    You can use the below procedure to delete specific columns:

    Sub sbDeleteColumns()
    arrCol = Array("A", "C", "G", "H") 'always in ascending order
    For i = UBound(arrCol, 1) To 0 Step -1
    End Sub

    Please note: Always store all the Column names in an array variable(arrCol) in ascending order.


  5. Clark August 14, 2015 at 2:55 AM

    How can I delete multiple columns for columns A, C, H, K-O, Q-U. Column K-O means column K to O. Thank you.

  6. PNRao August 14, 2015 at 3:21 PM

    Hi Clark,

    I have updated the post with the example. Please check the last example to delete multiple specific columns from the excel workbook sheet.


  7. chitra September 28, 2015 at 10:08 AM

    Hi Friend,

    i have data of around 900 columns and i need to delete every 3 columns after first column, how do i do this…. eg: i have to leave column 1 and delete 2,3 &4 and leave column 5 and delete 6, 7, & 8 and leave 9 and so on….. help me….

  8. PNRao September 29, 2015 at 12:01 AM

    Hi Chitra,

    Please find the below code to delete columns as per above mentioned criteria.

    Sub Delete_Columns()
        Dim StCol As Integer, EnCol As Integer
        For iCntr = 1 To 900
            StCol = find_Column_Number(iCntr + 1)  'Start Column
            EnCol = find_Column_Number(iCntr + 3)  'End Column
            Sheets("Sheet1").Columns(StCol & ":" & EnCol).Delete
    End Sub

    ‘Function to find out column name from column number
    ‘For more detail:

    Function find_Column_Number(ByVal ColumnNumber As Integer)
    find_Column_Number = Replace(Replace(Cells(1, ColumnNumber).Address, “1”, “), “$”, “)
    End Function

    Regards- Valli

  9. Praveen November 1, 2015 at 11:37 PM

    Will you please help me with VBA code..
    R Name Dname Rcount Dcount
    Ramesh Arun
    Ramesh Arun
    Ramesh Ganesh 3 2(delete other duplicates keep 1st time appeared ) how to do it by vba..?

  10. Joe November 22, 2015 at 6:36 PM

    thanks for the macros — all very helpful.


  11. Syrine December 7, 2015 at 2:03 AM


    thank you for the code. Actually i want to execute the same code in my excel sheet because I need to do the same thing but it didn’t work. Would you help me find out what is wrong? I always receive the same error message “sub or function not defined”.

    Many thanks



  12. Mike January 4, 2016 at 9:17 PM

    Trying to use this for deleting multiple columns:

    Sub DelCols()


    End Sub

    Problem is I keep getting an exception on the colon between A & D. expected list seperator or )
    I don’t see the problem, but maybe I’ve just been staring at it too long


  13. PNRao January 4, 2016 at 10:11 PM

    Hi Mike,
    I have tried your code and its working for me.

    'your code
    Sub DelCols()
    End Sub

    Try this alternative code, this will use the Columns object:

    Sub deleteColumns()
    Dim strColumns As String
    Dim arrColumns,i
    strColumns = "A:D,H:L,O:X,AA:BG" 'Define your columns here
    arrColumns = Split(strColumns, ",")
    For i = 0 To UBound(arrColumns, 1)
    Next i
    End Sub


  14. Aaron January 28, 2016 at 8:54 PM


    I am creating a template to be used by numerous people for various projects which, depending on the project, a different number of columns will be required.

    To help explain, Columns A&B are fixed and I do not want any to be deleted. Columns C-Q have data for them for each country that is within a project. I currently have 15 columns here as this is the max number of countries possible. If someone uses data for a project with only 3 countries, columns C, D and E would display the country name as the header and relevant data underneath, and columns F – Q will just be blank (albeit with formulae within the cell just returning a blank result). I want to use a macro so the person can just press a button and it deletes these excess columns for them.

    Is this possible? Not sure if it makes it easier but could get the header to return a certain result rather than leaving blank, e.g. in columns F-Q, using the above example, the header would be ‘DELETE’. Could I then get a macro to search for any columns that show DELETE in the header and delete the entire column?

    Thank you in advance!

  15. poorna May 14, 2016 at 10:29 PM

    HI Sir,

    I want to delete non specific columns to be delete
    i have 3 sheets , each sheets contain 100+ columns , in that i require 15 columns only
    i want 15 columns & remaining to be deleted in every sheets at a time.
    Its urgent , taking more than 15 min for 3 sheets

  16. Ramy October 11, 2016 at 4:18 PM

    Am trying to delete over 2000 columns (replacing worksheet not an option). The VBA code is this:


    No matter what I do (using ClearContents, Clear, repair spreadhseet, reboot, clear Windows Temp folder), I always get the message: Run-time error ‘1004’: Delete method of range failed.

    When I try to break the delete into smaller segments, such as 100 columns at a time, as in:


    I get the message after roughly 700 columns.

    Am I hitting some sort of internal limitation? Is there some buffer that needs to be reset?


  17. vishnu March 31, 2017 at 6:54 PM


    Actually i have 100 columns in my excel sheet.I have to delete all empty columns in the sheet [Here, i don’t know which column number is empty].

    please help me to resolve this issue.


  18. Abdul May 29, 2017 at 8:22 PM


    Can anyone help me,

    I want to delete multiple columns and in many sheets (delete same columns; multiple in all sheets)

  19. Kapil kaushal February 27, 2019 at 2:04 PM

    Hi , Can someone help me with the below scenario.

    I have a column name “COMMENT” in my excel sheet. However the comment column comes 5 times or more than that.

    I need to keep the latest comment column and delete the rest other comment columns. I have tried to achieve this by using Range & cell values but the cell values are not static they are getting changed when i export any other document into excel.

    Please advise.

Leave A Comment