EXCEL: Deleting cell range (multiple sheets)

Closed
Moltenmagma - Aug 20, 2009 at 12:06 PM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Aug 20, 2009 at 09:03 PM
Hi,

I have been trying to figure out how to clear the contents of specified cell, say

Range (A12:U12).Select
ActiveCell.End(xlDown).Select
Selection.ClearContents

from n number of worksheets in 1 workbook.

I have tried using For loop but it only clears the selected sheet.

Is there a quicker solution to resolve this?

Thank you very much.
Related:

1 response

venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Aug 20, 2009 at 09:03 PM
try this macro
Sub test()
Dim j As Integer, k As Integer
j = Sheets.Count

For k = 1 To j
With Sheets(k)
.Range("a1:F1").Clear
End With
Next k
End Sub


I have chosen range("a1:F!").modify this line to suit you
"clearcontents" will clear contents only but not the formulas and formats
i
0