LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Delete rows if fits criteria in a Macro

Hi

I currently have a macro I'm working on in which there are 12 worksheets
(January to December).

In each spreadsheet I want to delete all rows that contain "0" in a
particular column but keep all the others.

This is the current code I'm using:

Columns("E:E").Select
Selection.NumberFormat = "0"

For Each c In Range("E1:E200")
If c = 0 Then Rows(c.Row).Delete
Next c

In the 12 worksheets, it deletes all but 1 or 2 of the rows I want gone.

How do I fix it so that all the rows are deleted?

Thanks in advance for your help.
Forest

 
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
Create a Macro to Delete All Rows that meet a certain criteria jpittari Excel Programming 1 November 1st 07 05:16 AM
Macro to Delete rows on a criteria [email protected] Excel Programming 2 August 8th 07 08:37 PM
Formula/Macro to delete rows that do not meet criteria from a list? S Davis Excel Worksheet Functions 2 July 12th 06 07:42 PM
Macro, delete rows that meet criteria Scott Wagner Excel Programming 4 December 23rd 05 12:06 AM
Cut and Paste macro based on criteria then delete empty rows samst Excel Programming 4 November 2nd 03 09:33 PM


All times are GMT +1. The time now is 06:41 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"