In Excel VBA is there a way to safely use Range("A1:B2").ClearContent
without deleting the existent formulas in the cells?
Just to make my scenario clearer: I'm pulling fresh data from the database and just want to erase everything on the sheet but not the formulas because those will resolve some data in other fields with vlookups.
Use the SpecialCells property to get only the constant values.
Sub RemoveConstants()
Dim rConstants As Range
Set rConstants = Sheet1.Range("A1:B2").SpecialCells(xlCellTypeConstants)
rConstants.ClearContents
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With