I created a clear all button on a sheet that needs to be cleared at the end of the year, ready for use at the start of the next year. The macro worked, but it also cleared out the table headings. (the names of each column)
This was the macro I used:
What do I need to add to it to prevent it from deleting the table headings?
This was the macro I used:
Code:
Sub ClearAllButFormulas()
Dim wks As Worksheet
For Each wks In Worksheets
'ignore errors in case there is only formulas
On Error Resume Next
wks.Cells.SpecialCells _
(xlCellTypeConstants, 23).ClearContents
On Error GoTo 0
Next
Set wks = Nothing
End Sub
What do I need to add to it to prevent it from deleting the table headings?