Option Explicit
Sub SetTextZero()
Dim Cel As Range, Txt As Variant
For Each Cel In Selection
If Left(Cel.NumberFormat, 2) <> ";;" Then
Cel.NumberFormat = ";;" & """" & Cel & """"
Cel.Value = 0
Cel.Interior.ColorIndex = 34
Else
Txt = Split(Cel.NumberFormat, ";")
Cel.NumberFormat = "#,##0.00"
Cel.Value = Mid(Txt(2), 2, Len(Txt(2)) - 2)
Cel.Interior.ColorIndex = 6
End If
Next
End Sub
|