This should be a piece of cake.
I have about 40 spreadsheets each with 12 worksheets (don't ask why - I inherited this)
Anyway, end of financial year - I need to clear all the data in a specifed range on all worksheets on all workbooks.
That's about 500 worksheets I need to delete - manually.![]()
I'd much rather do 40 workbooks than 500 worksheets so I was going to copy and paste this bit of code into each workbook - run it - watch the data get zapped and then go![]()
Should be simple - not asking for much and I'm sure it's just a syntax thing I'm missing.Code:Sub ClearWorksheet() Dim ws As Worksheet For Each ws In ActiveWorkbook.Worksheets Worksheets(ws).Range("A5", "AN905").ClearContents Next End Sub
I intend on opening a workbook, pasting in the sub and then running it. Open next workbook etc etc.




)
Reply With Quote