D
danpt
I need a vba code to replace all the cells having 0 value with empty cell in
a selected range.
Could there be a better way than the following:
Sub zerotoblank()
Dim r, c, rowstart, rowend, colstart, colend As Long
rowstart = Selection.Row
rowend = Selection.Rows.Count + rowstart - 1
colstart = Selection.Column
colend = Selection.Columns.Count + colstart - 1
For c = colstart To colend
For r = rowstart To rowend
If Cells(r, c) = 0 Then Cells(r, c) = ""
Next r
Next c
End Sub
a selected range.
Could there be a better way than the following:
Sub zerotoblank()
Dim r, c, rowstart, rowend, colstart, colend As Long
rowstart = Selection.Row
rowend = Selection.Rows.Count + rowstart - 1
colstart = Selection.Column
colend = Selection.Columns.Count + colstart - 1
For c = colstart To colend
For r = rowstart To rowend
If Cells(r, c) = 0 Then Cells(r, c) = ""
Next r
Next c
End Sub