replace null cells within a range to 0

G

Guest

Hi. Is there a way to check a range of cells within a worksheet to see if
they are null, and if so to replace it with a zero? I tried reformatting the
column, but it doesnt do anything with the nulls. It needs to be a number
because I am importing it to a linked file.
Thanks,
 
G

Guest

not sure if I understand what you mean with Null, but if you mean Null as in
Empty, you can write an easy macro
Sub Change_Empty_to_Zero
For every mycell in selection
if mycell = "" then mycell = 0
next
exit sub
 
G

Guest

Place a Zero in any cell and copy it. Now highlight the area with the
potential null (blank) cells. Select F5 (or ctrl+G or Edit -> Goto) and press
Special... -> Blanks.
All of the blank cells should now be selected. Paste the 0 that you copied.
 
D

Dave Peterson

Or just
Select the range
edit|goto|special|blanks
type 0
and hit ctrl-enter to fill all those empty cells in the original selection.
 
G

Guest

Thanks Dave... I know that I can do that but somehow I just always do the
copy and paste thing. I'm a creature of habit I guess... and somehow I assume
everyone should join me in my habits... :)
 
G

Guest

Wow. that worked like a charm! Thank you.

Jim Thomlinson said:
Thanks Dave... I know that I can do that but somehow I just always do the
copy and paste thing. I'm a creature of habit I guess... and somehow I assume
everyone should join me in my habits... :)
 

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

Top