ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   IsEmpty() Returns False in empty cells (https://www.excelbanter.com/excel-programming/328447-isempty-returns-false-empty-cells.html)

John Hutchins

IsEmpty() Returns False in empty cells
 
Occasionally when I use IsEmpty to see if a cell contains data like
"IsEmpty(Cells(x,y))" it returns "False" when there is nothing there. I've
tested the cell with Len(Cells(x,y)) and it returns 0. Does anyone know why
this happens or how to get around it?
Thanks,
John Hutchins

Tom Ogilvy

IsEmpty() Returns False in empty cells
 
It can contain a zero length string. This can be cause when you do a Paste
Special, Value when the cell contained a formula displaying ""

=if(true,"",false)

as an example.



--
Regards,
Tom Ogilvy

"John Hutchins" <John wrote in message
...
Occasionally when I use IsEmpty to see if a cell contains data like
"IsEmpty(Cells(x,y))" it returns "False" when there is nothing there.

I've
tested the cell with Len(Cells(x,y)) and it returns 0. Does anyone know

why
this happens or how to get around it?
Thanks,
John Hutchins




Vasant Nanavati

IsEmpty() Returns False in empty cells
 
IsEmpty(), while it seems to work for really empty cells, is meant to
determine if a variable has been initialized.

You may be better off testing as follows if you want cells with formulas
that return null strings to be considered empty:

?Cells(1, 1) = ""
False

--

Vasant


"John Hutchins" <John wrote in message
...
Occasionally when I use IsEmpty to see if a cell contains data like
"IsEmpty(Cells(x,y))" it returns "False" when there is nothing there.

I've
tested the cell with Len(Cells(x,y)) and it returns 0. Does anyone know

why
this happens or how to get around it?
Thanks,
John Hutchins





All times are GMT +1. The time now is 04:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com