Blanks -> 0 code

L

LiAD

Hi

Could someone give me a code please to replace a blank cell with a zero (0)
please? inisde the cell there is a formula which returns the blank

Thanks
LiAD
 
G

Gary''s Student

Sub zeroo()
For Each cel In Selection
If cel.Value = "" Then
cel.Value = 0
End If
Next
End Sub
 
R

Ryan H

If you use Gary's method you will delete the function that is in the cell.
If you want that then his method will work fine.

There is another option you could use. I'm not sure which version you are
using, but in Excel 2007 click the Windows icon in the upper left hand corner
and select Excel Options. Click Advanced, and scroll down to Display Options
for this Worksheet: then make sure the checkbox that reads "Show a zero in
cells that have a zero value" is set to True. This will show a "0" in all
your functions that calculate to "".

You can do it in Excel 2003 also. I'm just not sure which menu tab its
under. Try Tools or View, Maybe Edit.


Hope this helps! If so, click "YES" below.
 

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

Similar Threads

Delete code 6
If structure 8
Data Validation blanks for formulas 18
Paste and cut code 4
Copy and close code 4
Check a range to see if a value exists in it 5
Delete cells if 4
Simple workbook Protect 2

Top