REAL-TIME

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

Effortlessly
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

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

VBA Delete Active Column Excel Macro Example Code

VBA code to Delete Active Column


Here is the Example VBA syntax and Example VBA Macro code to Delete Active Column from excel worksheets. This will help you to know how to delete Active Column from Excel workbook using VBA.

VBA Delete Active Column: Syntax


Following is the VBA Syntax and sample VBA macro command to Delete Active Column from worksheet using VBA. We are using the Delete method of the Columns object of worksheet.


Columns(ActiveCell.Column).EntireColumn.Delete

Here ActiveCell.Column return the Column number of the active cell. And EntireColumn.Delete method will delete the Columns from the Excel spreadsheet.

Delete Active Column using VBA: Examples


The following Excel VBA macro code is to delete Active Column from the worksheet. This VBA macro will delete the Column which currently active.

Sub sbVBS_To_Delete_Active_Columns()
Columns(ActiveCell.Column).Delete
End Sub 

Instructions to run the VBA Macro code to delete Active Column


Please follow the below steps to execute the VBA code to delete Active Column.
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: select/ activate a cell for testing purpose
Step 6: Now press F5 to execute the code

Now you can observe that the Active Cell Column is deleted from worksheet.

Explained VBA Code to Delete Active Column


Starting program and sub procedure to write VBA code to delete Active Cell Column for worksheet.
Sub sbVBS_To_Delete_Active_Columns():
‘ActiveCell.Column returns the Active Column number.
‘And Delete method will delete the entire Column from the worksheet.
Columns(ActiveCell.Column).Delete
End Sub
Ending the Excel VBA Macro to delete the active Column.

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.

Save Up to 85% LIMITED TIME OFFER
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

Leave A Comment