Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Delete every other row in a 2007 spreadsheet

I need to delete every other row in a 2000 row Excel 2007 spreadsheet. Could
someone help me with the code with this. I am ok with Word VBA but NOT Excel.


Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default Delete every other row in a 2007 spreadsheet

Sub deleteAlternatingRows()

For i = Cells(Rows.Count, "a").End(xlUp).Row To 2 Step -2
Rows(i).Delete
Next i

End Sub

--
Please remember to indicate when the post is answered so others can benefit
from it later.


"Legal Learning" wrote:

I need to delete every other row in a 2000 row Excel 2007 spreadsheet. Could
someone help me with the code with this. I am ok with Word VBA but NOT Excel.


Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 124
Default Delete every other row in a 2007 spreadsheet

This is REALLY easy w/o VBA...

Use a helper (blank) column, insert a column if you'd like
At the start of your data (assuming you are not skipping blank rows, if so,
this isn't for you) put this formula =MOD(ROW(),2)
Copy down your entire data set
Filter on that column (Home tab | Editing group | Sort & Filter button) for
whichever odd/even row you want to delete (0 or 1)
Select the visible rows
Hit Ctrl + - (that is a minus sign)
Confirm delete entire row
Delete helper column

HTH

--
Zack Barresse



"Legal Learning" wrote in message
...
I need to delete every other row in a 2000 row Excel 2007 spreadsheet.
Could
someone help me with the code with this. I am ok with Word VBA but NOT
Excel.


Thanks!


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
emailing part of spreadsheet using Excel 2007 and Outlook 2007 Brian Excel Discussion (Misc queries) 1 February 12th 09 10:26 PM
hyperlink in Excel 2007 spreadsheet cell, to a Powerpoint 2007 sli Bob W Excel Discussion (Misc queries) 7 December 9th 08 09:13 PM
delete spreadsheet Johnny Mick[_2_] Excel Programming 5 June 23rd 08 05:33 PM
delete all the spreadsheet Nader Excel Discussion (Misc queries) 2 July 21st 05 02:56 PM
Is there a way to insert a formula, password or macro in an excel spreadsheet that will automatically delete the spreadsheet? oil_driller Excel Discussion (Misc queries) 1 February 8th 05 09:34 AM


All times are GMT +1. The time now is 06:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"