Resetting cells with 0 to empty cells

  • Thread starter Thread starter Luc
  • Start date Start date
L

Luc

How do i reset cells wich contain 0 (zero) to an empty cell.:

1.For an entire column
2. For a certain range, example I2 to I25

Thanxxx,

Luc
 
ActiveSheet.Range("I2:I25").Select
Selection.Replace What:="0", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
 
Select the cells (column or just a set of them) and run:

Sub clearum()
For Each r In Selection
If r.Value = 0 Then
r.Clear
End If
Next
End Sub
 
To replace 0 with "" in Column B:

Range("B:B").Replace What:="0", Replacement:="", lookat:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False

To do the same thing for I2 to I25, replace "B:B" with "I2:I25".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top