Channel | Publish Date | Thumbnail & View Count | Actions |
---|---|---|---|
| 2019-09-03 06:15:58 | ![]() 48,823 Views |
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
Please take the opportunity to connect and share this video with your friends and family if you find it useful.