Excel VBA code to Delete Active row example will help us to delete the row in excel worksheet which is active. We can use Delete method of Rows to delete the Active row. In this example we will see how to delete the Active row in excel worksheet using VBA. Excel VBA Macro code for deleting Active row macro should work for all the version of Microsoft Excel 2003, Excel 2007, Excel 2010, and Excel 2013.
50+ Project Management Templates Pack
Excel PowerPoint Word
Advanced Project Plan & Portfolio Template
Business Presentations Templates Pack
20+ Excel Project Management Pack
20+ PowerPoint Project Management Pack
10+ MS Word Project Management Pack
VBA code to Delete Active row
Here is the Example VBA syntax and Example VBA Macro code to Delete Active row from excel worksheets. This will help you to know how to delete Active row from Excel workbook using VBA.
VBA Delete Active row: Syntax
Following is the VBA Syntax and sample VBA macro command to Delete Active row from worksheet using VBA. We are using the Delete method of the Rows object of worksheet.
Here ActiveCell.Row return the row number of the active cell. And EntireRow.Delete method will delete the rows from the Excel spreadsheet.
Delete Active row using VBA: Examples
The following Excel VBA macro code is to delete Active row from the worksheet. This VBA macro will delete the row which currently active.
Sub sbVBS_To_Delete_Active_Rows() Rows(ActiveCell.Row).Delete End Sub
Instructions to run the VBA Macro code to delete Active row
Please follow the below steps to execute the VBA code to delete Active row.
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 row is deleted from worksheet.
Explained VBA Code to Delete Active Row :
‘Starting program and sub procedure to write VBA code to delete Active Cell Row for worksheet
‘ActiveCell.Row returns the Active Row number
‘And Delete method will delete the entire row from the worksheet
‘Ending the Excel VBA Macro to delete the active row