emtpy cell

L

Lee

I am new to programming and wonder if there is a way to check for a emty cell
( a cell that has the value of 0). I have a column B57:B76 I would like to
check if B57 has anything >0 if it does move to b58 and check if that is >0
and so on. When the program finds the first cell that is a emty cell, it then
used data on a other worksheet and the number in the last cell it checked for
the calculations to be placed in B77.

I think I could do it with if statements. I think it might be to long.

thanks for any help
 
T

Tom Ogilvy

A cell containing 0 is not empty - but regardless, perhaps this will help:

Dim cell as Range
for each cell in Range("B57:B76")
if isempty(cell) then
msgbox cell.Address & " contains nothing"
exit for
elseif isnumeric(cell) then
if cell.Value = 0 then
msgbox "contains zero " & cell.address
exit for
end if
end if
Next
 
G

Gary's Student

VBA gives several options:

IsEmpty function can test for truely empty.
You can also check for an entered zero.
You can also check for the presence of a formula that is currenly yielding
zero.
 

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