Thread: Delete Rows
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Delete Rows

Hi John,

The suggested code only looks at the Names range and it only deletes rows
whose column G value is Fred. Rows which do not satify these two
requirements will not be deleted.

If, however, your intention is to delete the content of such rows, rather
than deleting the rows themselves, try changing the line:

delRng.EntireRow.Delete


to

delRng.EntireRow.ClearContents

And if your intention is only to delete the contents of that part of the row
which intersects with the Names range, then change the above line to:

Intersect(delRng.EntireRow, SH.Range("Names")).ClearContents



---
Regards,
Norman


"JohnUK" wrote in message
...
Hi Norman,
Thanks for your help.
I ran your code and instead of deleting the rows with the name I entered
into the range, it deleted the range instead.
Did I do something wrong
John