Deleting cells in multiple worksheets

  • Thread starter Thread starter markstro
  • Start date Start date
M

markstro

I would like to automate the deletion of cells in 20 worksheets I use
as a calculator for payroll pages.
The cell range is A3:G12 in consecutively numbered worksheets 1-20.
I thought of recording a macro, is there a simpler way?
Thanks,
Mark
 
Mark, here is one way select sheet one, shift and click on sheet 20, this
will group the sheets, select A3:G12 and hit delete, click on a sheet tab to
ungroup
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 97 & 2000
** remove news from my email address to reply by email **
 
Hi Mark
if you want to clear this range for all worksheets in your workbook you
may use the following macro

sub delete_range()
dim wks as worksheet
application.screenupdating = false
for each wks in activeworkbook.worksheets
wks.range("A3:G12").clearcontents
next
application.screenupdating = True
end sub
 
When you say delete, do you mean just delete the contents? in which case just
select the first sheet, hold down shift and select the last sheet, and then
select your range and hit the delete button.
 
Oops - And don't forget to ungroup afterwards by clicking on another tab that is
not grouped, or right-clicking on one that is and choosing ungroup.
 
Or...here is another way:

Sub dltRange()
Sheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet4")).Select
Range("A3:G12").ClearContents
End Sub

is doing the manual job of selecting all the sheets and deleting th
range as Paul B stated...but automatically... ;)

Have a good day,

Dav
 
Back
Top