is there a way to delete alternate rows in excel

G

Guest

I have a table generated by a datalog program running for about 7 days.
Unfortunately the log interval was inadvertantly set to 5 instead of 30
seconds, & the data now extends over 2 text files, each of about 65000 lines,
close to the Excel 2003 limit. Can anyone advise a simple way to delete
alternate rows, either in the text file or in the excel file?
 
G

Guest

Hi,

To delete every other row in a worksheet. Right click the sheet tab, view
code and paste this in:-

Sub sonic()
Dim x As Long
Dim LastRow As Long
LastRow = Range("A65536").End(xlUp).Row
For x = LastRow To 1 Step -2
Rows(x & ":" & x).Delete
Next x
End Sub

Mike
 
B

Bernard Liengme

Mike has a good solution but if VBA is not for you:
Insert a new A column
In A1 enter 0, in A2 enter 1
Copy A1:A2 down to end of worksheet, resulting in 0,1,0,1,0,1....
Sort all the data using A as the key
Now delete either the top or the top half
Then delete column A
best wishes
 
D

David Biddulph

Set up a column =MOD(ROW(),2), filter by that, & delete the unwanted rows.
If you've got data at 5 seconds instead of 30, it sounds like you might want
=MOD(ROW(),6)
 
G

Guest

Hey, Bernard -- you should have a "MVP" logo after your name -- ask Mike F
about how this happens. And, in case I forgot, congrats! (Or am I mistaken??)
 

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

Top