PDA

View Full Version : Solved: Cells with zero or no value - amend



Klartigue
09-12-2011, 01:13 PM
On the attached spreadsheet, columns W to Z have cells with a value of 0 or have no value. How do I write a macro to identify these cells and replace them with a "-"?

Thank you for your help, I really appreciate it.

mancubus
09-13-2011, 02:13 AM
Sub ZerosAndBlanks()
Dim cll As Range, rng As Range
Set rng = Range("W6:Z" & Cells(Rows.Count, "W").End(xlUp).Row)
For Each cll In rng
If cll.Value = "" Or cll.Value = 0 Then cll.Value = "-"
Next cll
End Sub