I want to delete every alternate row from my work sheet. I tried recording macro, but it only deletes a particular row as shown below (Row 4:4). How can this macro be converted to a more versatile one?
Sub Macro3() Macro3 Macro Keyboard Shortcut: Ctrl+q Rows("4:4").Select Selection.Delete Shift:=xlUp End Sub
Just use the macro below:
Sub deleteAlternateRow() Dim startAtRow, endAtRow, rowCounter As Long startAtRow = 2 endAtRow = 100 For rowCounter = startAtRow To endAtRow Rows(rowCounter).Select Selection.Delete Shift:=xlUp Next End Sub
Thanks to rizvisa1 for this tip on the forum.
- Delete every other row in excel
- Delete alternate rows in excel - Best answers
- Excel delete every other row - Best answers
- Deleting and combining rows in excel with con ✓ - Forum - Excel
- Macros to Delete Rows in Excel 2007 ✓ - Forum - Programming
- Deleteing Rows in excel ✓ - Forum - Excel
- Conditionally deleting rows in excel 2007 ✓ - Forum - Excel
- Excel vba delete all table rows except first ✓ - Forum - Excel