MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Multiple SheetClearContents


Posted by Alex on January 03, 2002 4:13 AM

Id like to clear same ranges on multiple sheets as fast as possible, but cant get the following code going...any help is appreciated...thanks...alex

Sub MyMultipleSheetClear()
mysheets = Array("Sheet1", "Sheet2", "Sheet3")
Worksheets(mysheets).Range("A1:B10").ClearContents
End Sub


Posted by Guildenstern on January 03, 2002 7:17 AM


I've wondered for a very long time why the code syntax you've posted doesn't work. All I've ever got to work is the following, which seems to me to be a bit unwieldy. Would appreciate any explanation as to why it has to be done this way, or preferably how it can be done another way.

Sheets(Array("Sheet1", "Sheet2", "Sheet3")).Select
Range("A1:B10").Select
Selection.ClearContents