(Solved) – How to delete contents of cell without removing its formula

(solved)-–-how-to-delete-contents-of-cell-without-removing-its-formula

Using Excel VBA, how do you clear the contents of a cell without deleting the formula? I have tried the ones below to no avail. All of them deletes even the formula. dataSheet is a Sheet. Thanks for anyone who considered to help and who helped.

dataSheet.Range("A1").Value = ""
dataSheet.Range("A1").SpecialCells(xlCellTypeConstants).ClearContents
dataSheet.Range("A1").SpecialCells(xlCellTypeConstants).Clear
dataSheet.Range("A1").ClearContents
dataSheet.Range("A1").SpecialCells(xlCellTypeFormulas).ClearContents
dataSheet.Range("A1").SpecialCells(xlCellTypeFormulas).Clear

Leave a Reply

Your email address will not be published. Required fields are marked *