View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
al al is offline
external usenet poster
 
Posts: 363
Default macro to enter zero into 240 ranges?

Per, I have successfuly used your macro! Thanks, but one thing I have just
noticed...it clears the cells, whereas I would like to enter the value zero
into the cells. (I have custom formatting for "zero" cells, and other If
formulae if the cells are zero values.
How can we change your initital macro?


"Al" wrote:

Per, thank you. Noted re the template...we have that currently but human
nature being what it is people always want short-cuts and tend to use a
"completed" spreadheet from an earlier job, rather than a template! Also my
spreadsheet has other data specific to various clients that is constant,
hence the use of an older spreadsheets is actually a good way of doing it.

I'll try your macro...any idea how many ranges I can have?

Al

"Per Jessen" wrote:

Hi

I think you shold save your spreadsheet (with no date) as a template. Then
you can always start a new project based on the template.

IF you want to clear ranges in current sheet, the macro below will do the
job. Just notice I do'n think you can have all 240 ranges in one statement.

Sub ClearRanges()
Dim ClearRange As Range
Set ClearRange = Application.Union(Range("A7:L21"), Range("A25:L37"))
ClearRange.ClearContents
End Sub

Regards,
Per

"Al" skrev i meddelelsen
...
I wish to enter the value zero into various ranges within my spreadsheet.
(Wiping clean all prior data entries across the spreadsheet, so that the
next
project can start.)
e.g. A7:L21, A25:L37, A42:L57, P7:AB21, P25:AB37, etc etc
There are currently 240 such ranges.
Do these need to be named?
Presumably some VBA code is the answer...can someone suggest something
please?