ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Adjusting Macro (https://www.excelbanter.com/excel-discussion-misc-queries/136239-adjusting-macro.html)

M.A.Tyler

Adjusting Macro
 
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

Dave Peterson

Adjusting Macro
 
How about:

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

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

M.A.Tyler wrote:

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


--

Dave Peterson

Don Guillett

Adjusting Macro
 
try

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

--
Don Guillett
SalesAid Software

"M.A.Tyler" <Great Lakes State wrote in message
...
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





All times are GMT +1. The time now is 10:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com