Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default How to zero out non-contiguous ranges

for each cell in Range("A2:A35")
if cell.locked = False then
cell.clearcontents
end if
Next

--
Regards,
Tom Ogilvy


"Dean" wrote:

I have a range name which involves about four non-contiguous blocks of
contiguous cells (say, cells a2 to a4, then a7 to a12, then a15 to a18, then
a30 to a35, right now, though I might later insert some rows in the middle,
so the range name's cells would adjust). I would like to just set all cells
in these blocks to zero with a macro in the easiest way possible. Actually,
easier yet, would be to set the whole range to zero from cells a2 to a35,
but have it skip any cells whose format is protected, whether or not
protection is actually on.

Can someone give me the code to do that?

Thanks!
Dean



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Non contiguous ranges AD108 Excel Programming 4 November 23rd 06 03:59 PM
vlookup on non-contiguous ranges BorisS Excel Worksheet Functions 2 June 15th 06 10:28 AM
summing non contiguous ranges valaor Excel Discussion (Misc queries) 6 March 22nd 06 04:17 PM
sorting non contiguous ranges gsh20 Excel Discussion (Misc queries) 1 September 8th 05 04:50 PM
Borders - non-contiguous ranges Richard[_20_] Excel Programming 5 January 19th 04 06:14 PM


All times are GMT +1. The time now is 07:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"