Null exist in Excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
 
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
 

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

Back
Top