ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Null exist in Excel (https://www.excelbanter.com/excel-programming/387748-null-exist-excel.html)

clara

Null exist in Excel
 
Hi all,

Before a cell is filled, is it Null or "" ? and how tell a cell filled by a
formula ?


Clara
thank you so much for your help

Vergel Adriano

Null exist in Excel
 
Clara,

I think an unused cell would be a null string value ("") but not NULL.
Created a new workbook, then in the Immediate window:

?ISNULL(sheet1.Range("A1").Value)
False

?sheet1.Range("A1").Value=""
True

To tell if a cell has a formula, check the HasFormula property. For example,
I placed =A1 in B1. then in the Immediate window:

?sheet1.Range("B1").HasFormula
True



--
Hope that helps.

Vergel Adriano


"clara" wrote:

Hi all,

Before a cell is filled, is it Null or "" ? and how tell a cell filled by a
formula ?


Clara
thank you so much for your help


Dave Peterson

Null exist in Excel
 
I'd use:

dim myCell as range
set mycell = somecell 'single cell only
if isempty(mycell.value) then
'nothing, not even a formula
else
'something
end if

If you check
if mycell.value = "" then
It could contain a formula that evaluates to ""
(=If(a1=7,"ok","")

And you can test to see if a cell contains a formula with:

if mycell.hasformula then



clara wrote:

Hi all,

Before a cell is filled, is it Null or "" ? and how tell a cell filled by a
formula ?

Clara
thank you so much for your help


--

Dave Peterson


All times are GMT +1. The time now is 05:43 PM.

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