View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Per Jessen Per Jessen is offline
external usenet poster
 
Posts: 1,533
Default macro to enter zero into 240 ranges?

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?