Deleting specific rows/columns from excel

How do I delete a range of rows using VBA?

Excel VBA Examples for Deleting multiple Rows at time

The following example will delete Row 5 to 10 at a time from the active worksheet.

'In this Example I am deleting Rows 5 to 10
Sub sbDeleteARowMulti()

Rows("5:10").Delete

End Sub

Instructions

  1. Open an Excel Workbook
  2. Press Alt+F11 to open VBA Editor
  3. Insert a Module from Insert Menu
  4. Copy the above code and Paste in the code window
  5. Save the file as macro enabled workbook
  6. Press F5 to execute it

Source Delete Rows and Columns in Excel VBA


You may also like to try the Go To function. Very simple: on your mac, press CTRL+G (control, not command) and the Go To dialog will open.

Do you want to delete the entire rows between 325890-500000? If so enter 325890:500000 and click OK. Excel will select the rows, and you can right-click on any of the row numbers on the left, and delete, or clear contents.

Or do you want to delete only within column B across those rows? If so enter b325890:b500000 and click OK. Excel selects those cells and you can delete (and shift cells) or clear contents.