Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
loop to delete rows...
here's the issue: I'm trying to delete all the rows which
start with "total:" and "subtotal:" in column A. I had to use 2 loops because when there is a subtotal row directly followed by a total row, the total row is "skipped". I'm not sure that I'm making myself very clear but any help would be appreciated... Ideally I'd like to replace the 2 loops by 1. Here's what I have so far: sub delRows() Dim c As Range For Each c In Range(Range("a1"), Range("a1").End (xlDown)).Cells If c.Text Like "SubTotal*" Then c.EntireRow.Delete End If Next c For Each c In Range(Range("a1"), Range("a1").End (xlDown)).Cells If c.Text Like "Total*" Then c.EntireRow.Delete End If Next c end sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Loop & Delete | Excel Discussion (Misc queries) | |||
How to Delete Rows in Excel In a Do Loop | Excel Worksheet Functions | |||
Adding a loop to conditional delete code | New Users to Excel | |||
Excel VBA - Help with a loop, compare, delete problem | Excel Programming | |||
How do I delete rows and columns in With With End Loop? | Excel Programming |