Delete nth rows

grejta

New Member
Joined
Jan 6, 2022
Messages
37
Office Version
  1. 2013
Platform
  1. Windows
Dear Sir,
I need help for delete one row every 10 rows, Starting from first row #6 than #18 and so on till the end row 1193

Thank you in advanced,
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
• Manual solution (using a helper column)
- Assuming : Start row 6, Delete every 10th row
- In a blank helper column at the starting row enter (row 6) : =IF(MOD(ROW()-6,10)=0,1,””)
- Fill down
- Select the helper column and go to SpecialCells>Formulas>Numbers>OK
- Delete>Entire row
- Delete the helper column

• VBA
VBA Code:
Sub DeleteRows()
Dim totRows&, nthRow&, startRow&, endRow&, r&

totRows = 1193 'Total rows
nthRow = 10    'Every nth row to be deleted
startRow = 6   'Start row
endRow = totRows - (totRows - startRow) Mod nthRow

Application.ScreenUpdating = False
For r = endRow To startRow Step -nthRow
    Rows(r).Delete
Next
Application.ScreenUpdating = True
End Sub
 
Upvote 1
Solution

Forum statistics

Threads
1,224,828
Messages
6,181,204
Members
453,022
Latest member
RobertV1609

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top