View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions,microsoft.public.excel.programming
Richard Buttrey Richard Buttrey is offline
external usenet poster
 
Posts: 296
Default Deleting contents of cells in non contiguous ranges

On Fri, 31 Mar 2006 20:55:47 +0100, "Bob Phillips"
wrote:

If they are always the same cells, surely the colour is irrelevant. Couldn't
you just use

range("B30:X50,B70:X90,B130:X150").ClearContent s


Bob,

Yes I could do that. I was hoping to avoid having to hard code or name
these ranges and have some sort of generic code.

There are about 15 sheets with an average of 4 ranges on each sheet.
The other complication is that from time to time the user needs to add
another sheet and add a few more ranges. Without some sort of generic
code the macro would need to be added to each time.

At the moment I just specify the whole of columns A:X from the first
row to the last row on the sheet and loop through every cell checking
the colour and clearing as necessary.

Which works fine, but takes 20 minutes or so.

Rgds

__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________