deleting rows

E

Eric

Hello

I have a macro which searches row by row for trigger
values which mark the beginning and end of rows to be
deleted.

I can delete these rows one at a time, but would deleting
them at all at one time be better, and if so what would
the code be?
 
S

Stan Scott

Eric,

As your macro searches for the ranges, give each one a range name, such as
"rng1", "rng2", and "rng3". Then, this code will delete all of the rows at
once:

Application.Union(Range("rng1"), Range("rng2"),
Range("rng3")).EntireRow.Delete

Delete the temporary range names, and you're done.

Stan Scott
New York City
 
Top