VBA to delete column values and formats NOT formulas

  • Thread starter Thread starter Hugo
  • Start date Start date
H

Hugo

This is what I have:

Sub ClearColumns()
dtTemp = Range("C1")
lngLastCol = Cells(1, Columns.Count).End(xlToLeft).Column
For lngcol = 4 To lngLastCol
If CDate(Cells(1, lngcol)) > dtTemp Then _
Columns(lngcol).ClearContents
Next
End Sub

How do I make this so it only deletes cell values and formatting?
 
It seems to me that if you leave the formulas, then they will calculate a
value based on their precedents/dependents and the cells will still reflect
a value. If you turn off calculation, you would still have to make the cell
values equal to and empty string to appear empty. I think you are in a
catch 22.
 
Back
Top