ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Loop thru woorksheets (https://www.excelbanter.com/excel-programming/373686-loop-thru-woorksheets.html)

Striker

Loop thru woorksheets
 
I need to loop thru each worksheet in a workbook and clear the contents
except for the header row. Can anyone suggest a good way to do this in VBA?


Thank You



Dave Peterson

Loop thru woorksheets
 
option explicit
sub testme()
dim wks as worksheet
for each wks in activeworkbook.worksheets
with wks
.range("2:" & .rows.count).clearcontents
end with
next wks
end sub

Striker wrote:

I need to loop thru each worksheet in a workbook and clear the contents
except for the header row. Can anyone suggest a good way to do this in VBA?

Thank You


--

Dave Peterson


All times are GMT +1. The time now is 04:44 PM.

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