nanook3890
New Member
- Joined
- May 7, 2014
- Messages
- 21
Hi All,
Can anyone tell me why this code doesn't work? It only clears the active sheet so I know it's something to do with how I use the Worksheets/workbook bit.
All I need to do is clear the contents of the below range on every sheet in the workbook. Can anyone help please? Thanks so much in advance!
Sub Clearcontents()
Dim HolidayDates As Range
Dim wWorksheet As Worksheet
Set HolidayDates = Range("C19:E34")
With Workbooks("Annual Leave 2015.xlsx")
For Each wWorksheet In ActiveWorkbook.Worksheets
HolidayDates.Clearcontents
Next wWorksheet
End With
End Sub
Can anyone tell me why this code doesn't work? It only clears the active sheet so I know it's something to do with how I use the Worksheets/workbook bit.
All I need to do is clear the contents of the below range on every sheet in the workbook. Can anyone help please? Thanks so much in advance!
Sub Clearcontents()
Dim HolidayDates As Range
Dim wWorksheet As Worksheet
Set HolidayDates = Range("C19:E34")
With Workbooks("Annual Leave 2015.xlsx")
For Each wWorksheet In ActiveWorkbook.Worksheets
HolidayDates.Clearcontents
Next wWorksheet
End With
End Sub