Deleting every second row? 
Author Message
 Deleting every second row?

Can someone please tell me how to delete every other row
(1000 rows total.) in an Excel 2000 spreadsheet?
  Thanks!


Mon, 06 Jun 2005 07:28:43 GMT  
 Deleting every second row?
Eric

This will delete every even-numbered row starting with row 2.

Sub delete_even_rows()
  Dim r As Long
  Dim Rng As Range
  Dim numLoops As Long

  Set Rng = [A1:A2000]
''or 1000 if that is total rows
  numLoops = Int((Rng.Rows.Count / 2))
  For r = 1 To numLoops
    Rng(r + 1, 1).EntireRow.Delete
''change r + 1 to r + 2 for odd rows
  Next
End Sub

Gord Dibben  Excel MVP - XL97 SR2

Quote:

>Can someone please tell me how to delete every other row
>(1000 rows total.) in an Excel 2000 spreadsheet?
>  Thanks!



Mon, 06 Jun 2005 08:16:07 GMT  
 Deleting every second row?
Here is an interactive solution to delete even rows.

Insert a column.
Enter into top cell =Mod(1+Row(),2)
  (or =Mod(Row(),2) to delete odd rows).
Fill to row 2000.
AutoFilter the column on 1.
Select top cell. Hold Shift, press End, then Down.
Right-click Selection.
Choose Delete Row.
Delete Column.


Quote:
> Can someone please tell me how to delete every other row
> (1000 rows total.) in an Excel 2000 spreadsheet?
>   Thanks!



Mon, 06 Jun 2005 09:47:41 GMT  
 Deleting every second row?
Thanks Bob and Gord!


Mon, 06 Jun 2005 10:23:49 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. how to delete every second row

2. Please - Macro that deletes every second row

3. delete every second row

4. Deleting every second row

5. Getting #deleted message in every field of every row when linking to a SQL Server DB

6. Deleting several rows every nth row

7. duplicating every second row

8. inserting a row to every second line.

9. re : choose every second row

10. adding every second cell in a row


 
Powered by phpBB® Forum Software © phpBB Group