ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA to delete column values and formats NOT formulas (https://www.excelbanter.com/excel-programming/430968-vba-delete-column-values-formats-not-formulas.html)

HUGO

VBA to delete column values and formats NOT formulas
 
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?
--
Hugo

JLGWhiz[_2_]

VBA to delete column values and formats NOT formulas
 
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.


"Hugo" wrote in message
...
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?
--
Hugo





All times are GMT +1. The time now is 10:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com