From: JeffF on
I'd appreciate some help in creating a macro to delete rows.
Here's what I need:
1) Delete rows 1-13
2) Then find all rows that are highlited blue and delete them
3) Then find all rows that include the text "Distr" and delete them

Suggestions?
Thanks in advance.

From: Don Guillett on
Tell us how the rows came to be blue...

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett(a)gmail.com
"JeffF" <JeffF(a)discussions.microsoft.com> wrote in message
news:863D165C-D100-42E5-9294-3569F1829DF0(a)microsoft.com...
> I'd appreciate some help in creating a macro to delete rows.
> Here's what I need:
> 1) Delete rows 1-13
> 2) Then find all rows that are highlited blue and delete them
> 3) Then find all rows that include the text "Distr" and delete them
>
> Suggestions?
> Thanks in advance.
>

From: Mike H on
Jeff,

Where we we look for "Distr", anywhere on the sheet, in a particular column?
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"JeffF" wrote:

> I'd appreciate some help in creating a macro to delete rows.
> Here's what I need:
> 1) Delete rows 1-13
> 2) Then find all rows that are highlited blue and delete them
> 3) Then find all rows that include the text "Distr" and delete them
>
> Suggestions?
> Thanks in advance.
>
From: Hakyab on
For 1:

mysheet.Range("A1:A13").entirerow.delete

for 3:
dim c as range

set c = mysheet.cells.find "Descr"

do until c is nothing
c.entirerow.delete
set c = nothing
set c = mysheet.cells.findnext
loop


// Find has more parameters which I ignored. Sorry cannot help as easily
with your question 2. Find should be able to get specific formatting, I just
do not know.

Hope this helps,

"JeffF" wrote:

> I'd appreciate some help in creating a macro to delete rows.
> Here's what I need:
> 1) Delete rows 1-13
> 2) Then find all rows that are highlited blue and delete them
> 3) Then find all rows that include the text "Distr" and delete them
>
> Suggestions?
> Thanks in advance.
>
From: JeffF on
Thanks for the replies all.

For #2, its actually not "Distr", it is "District" and it is only in column
A. So I would want it to go: search in column A for the word "District"; when
found, delete the row it is in; repeat until no more found.

How they became blue?... this is an export from a web database. The export
adds all districts to one worksheet. They put that blue header row and a few
blank rows at the beginning of each district. We don't care about separating
them by districts so we just want all of the data to be contiguous. And, we
can't properly filter if those header rows are in the way.

If you could say "start the macro on row 5 and delete any row where you find
the phrase "Facility Name" and don't repeat" that would do it as well, as
"Facility Name" is one of the headers that I doubt would ever appear as real
text in the worksheet.

Thanks again,
Jeff