How do I delete every other line in an Excel document with over 3.

G

Guest

I have a rather large document where I need to delete every other line
beginning with line 8. I am looking for a shortcut rather than manually
deleting each line.
 
F

Frank Kabel

Hi
this would require VBA or you may try the following procedure
in B1 put the following formula:
=MOD(ROW(),2)
and copy this down for all rows.
Now apply an autofilter and filter out every 1 or 0 and afterwards delete
the filtered rows
 
J

Jason Morin

Try this macro:

Sub DeleteRows()

Dim iLastRow As Integer
Dim i As Integer
Dim iRem As Integer

Application.ScreenUpdating = False

iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
iRem = iLastRow Mod 2

If iRem = 1 Then
iLastRow = iLastRow + 1
Else
iLastRow = iLastRow
End If

For i = iLastRow To 8 Step -2
Cells(i, "A").EntireRow.Delete
Next i

Application.ScreenUpdating = True

End Sub
 
A

Alan Beban

Darren said:
I have a rather large document where I need to delete every other line
beginning with line 8. I am looking for a shortcut rather than manually
deleting each line.

If the functions in the freely downloadable file at
http://home.pacbell.net are available to your workbook, then assuming
your data is on Sheet1 in Columns A:K

Array enter into A1:K7 of an empty sheet =Sheet1!A1:K7

and array enter into A8:A[whatever] of that sheet
=ArrayAlternates(Sheet1!A8:K[whatever],False)

Alan Beban
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top