Automatically Clear Contents of Worksheet without Clearing Formulas @Exceltrainingvideos
Automatically Clear Contents of Worksheet without Clearing Formulas  @Exceltrainingvideos
Uploaded September 2019 | Updated September 2026, 2 weeks ago
How to automatically clear contents of a worksheet without deleting the formulas using VBA. Below is the complete VBA code:

Option Explicit

Sub removeMyConstants()

Dim myConstants As Range
Dim cel As Range

Set myConstants = Sheet1.Range("A1:F4").SpecialCells(xlCellTypeConstants)
On Error Resume Next
myConstants.ClearContents

For Each cel In Range("A1:F4")
If cel.Value = 0 Then

cel.NumberFormat = "#;#;"

End If

Next

End Sub
Automatically Clear Contents of Worksheet without Clearing FormulasHide Show Ribbon in Excel Using VBAAutomate Saving New File VersionPlay Sound in Excel Automatically Using VBA MacroFree Date and Time Picker Add-InCreate Folders and Files AutomaticallyInsert Hyperlink Automatically YouTube ShortsWhatsapp Desktop Automation with VBAFind Specific Word in TextClean Data Using Flash Fill in ExcelAPIs in Excel. No VBA. Use Power Query.Text To Columns Using Macro in Excel
Dinesh Kumar Takyar |

Automatically Clear Contents of Worksheet without Clearing Formulas

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER