Make zeroes in Selection nothing ""

  • Thread starter Thread starter MikeF
  • Start date Start date
M

MikeF

My code navigates to and selects a range, then needs to change all zeroes to
blanks, nothing, "" .

Is there a quick trick to this that I'll slap my forehead over?

Thanx,
- Mike
 
This will do it for you:

Sub DelZeros()
For X = 1 To 1
Dim redRng As Range

Set redRng = Range("A1", Range("J100").End(xlUp))
For Each Cell In redRng

If Cell.Value = 0 Then
Cell.Value = ""
End If

Next Cell
Next X
End Sub

Remember to make a back of your Excel file, just in case the result
is...ummmm...unintended. It's a total PITA to try to recover lost data.

Also, notice the range, A1:J100. Change to suit your needs.

Regards,
Ryan---
 
Are they values or formulas?

If they're values:

Select the range and then
edit|replace
what: 0
with: (leave blank)
replace all

Make sure you match entire cell constants.

Record a macro when you do it manually and you'll have the code.
 

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