PDA

View Full Version : Solved: Delete specific rows from all spreadsheets



ssinghal
01-07-2007, 10:47 AM
I need to delete the first 3 rows of every worksheet in the current workbook. Could someone give me the code to do this in a module?

JonPeltier
01-07-2007, 11:20 AM
Sub DeleteFirstThreeRows()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Range("1:3").Delete
Next
End Sub

mdmackillop
01-07-2007, 12:14 PM
Hi Ssinghal
Welcome to VBAX
I've retitled your question title to make it more meaningful for searches. If your question is solved, you can mark it so using the Thread Tools dropdown.
Regards
MD

XLGibbs
01-07-2007, 03:17 PM
You can also do this manually for all sheets needed by:

Holding down CTRL and selecting all the sheets by clicking them (or by clicking the left most and then finding the right most and clicking to select all sheets, or by right clicking any sheet tab and choosing Select All Sheets.

Once selected, you can rows 1 to 3 in any column on the sheet you are on, right click>delete entire row and <poof> they are gone.