I use this code to delete cells that have zero in them (constant zero NOT the result of a formula); so the code will not delete numbers<> 0, formulas (even if the result is zero), or text. My only problem is that it takes very long for this code to check every cell in my selection, which is always different and large. Please can you help me out to speed up this macro?
Thank you so much.
Sub deletezero()
Dim myselection As range
Set myselection = Selection
On Error Resume Next
For Each c In myselection
If (WorksheetFunction.IsNumber(c) And Not (c.HasFormula) And c.FormulaR1C1 = "0") Then
c.Value = ""
ElseIf (c.HasFormula Or WorksheetFunction.IsText(c)) Then
c.Formula = c.Formula
End If
Next c
End Sub
This message was edited by Vera on 2002-10-14 17:25
Thank you so much.
Sub deletezero()
Dim myselection As range
Set myselection = Selection
On Error Resume Next
For Each c In myselection
If (WorksheetFunction.IsNumber(c) And Not (c.HasFormula) And c.FormulaR1C1 = "0") Then
c.Value = ""
ElseIf (c.HasFormula Or WorksheetFunction.IsText(c)) Then
c.Formula = c.Formula
End If
Next c
End Sub
This message was edited by Vera on 2002-10-14 17:25