Adjusting Macro

G

Guest

Can the following macro be adjusted to NOT clear the 1st rows of pages 1, 5,
7 and 8? This is where the headers are, and they are used in other formulas.

Thanks.

M.A.Tyler.

Sheets("Sheet7").Select
Cells.Select
Selection.ClearContents
Sheets("Sheet8").Select
Cells.Select
Selection.ClearContents
Sheets("Sheet5").Select
Cells.Select
Selection.ClearContents
Sheets("Sheet1").Select
Range("P245").Select
 
D

Dave Peterson

How about:

worksheets("sheet1").range("A2:iv65536").clearcontents
worksheets("sheet5").range("A2:iv65536").clearcontents
worksheets("sheet7").range("A2:iv65536").clearcontents
worksheets("sheet8").range("A2:iv65536").clearcontents

(If you're using xl2007, change IV65536 to that bottom right cell's address.)
 
D

Don Guillett

try

myarray=array("sheet1","sheet,5", etc)
for each c in my array
sheets(c).rows("2:1000").clearcontents
next c
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top