Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
deleting rows in a non-continous range
Try this
For x = 2 To 100000 If Range("A" & x) = "" Then Exit For If Range("A" & x) = 0 Then Range("A" & x).Delete x = x + 1 End If Next x -- "Tim McPhillips" wrote in message ... I need help with the following problem. A worksheet with a non-continous range has data that occassionally has zero populated. I need code that will cycle through the entire range, identify if any cells are zero, and delete those rows. My code isn't working. This is what I came up with: With Workbooks("test").Worksheets("MHE").range ("CHECKRANGE") Set c = Workbooks("test").Worksheets("MHE").range ("CHECKRANGE") _ .Cells(1) For xy = 1 To Workbooks("test").Worksheets("MHE") _ .range("CHECKRANGE").Count If c.Value = 0 Then Set deleteaddress = range(c.Address) Set c = c.Next deleteaddress.Select selection.EntireRow.Delete Else Set c = c.Next End If Next xy End With Any help would be appreciated! Thanks, Tim |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Deleting a range of rows based on a variable; syntax error | Excel Discussion (Misc queries) | |||
MACRO HELP - deleting rows containing a range of blank cells | Excel Discussion (Misc queries) | |||
Deleting rows in a range using Autofilter | Excel Discussion (Misc queries) | |||
Deleting Range name's listed in the range address box. | Excel Discussion (Misc queries) | |||
deleting rows in a non-continous range | Excel Programming |