Thread: Logical tests
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Nigel[_2_] Nigel[_2_] is offline
external usenet poster
 
Posts: 735
Default Logical tests

The first two returns the text or value, where text is the string and value
is a variant. How you then use this value depends on what you intend to do
with it. The last is a logical test for a variable as to whether it has
been initialized. Therefore all three at not the same.

To be strictly applied then IsEmpty should read

IsEmpty(Range("A1").Value); is effectively doing the first by returning the
value from the cell A1 then applying a logical test to determine if it has
been initialized; if the cell has a value (not Null) then it returns true.
So If Range("A1").Value = "" then and IsEmpty(Range("A1").Value) are
equivalent in this case.

Note: That using IsEmpty only returns meaningful results for variants,
Range("A1").Text does not return a variant but text.



--

Regards,
Nigel




"Dave" wrote in message
...
Hello,

There may be more but when applying logical tests to a cell to check if it
is empty there are 3 common ones that seem to be used...

Range("A1").text
Range("A1").value
Isempty(Range("A1")

When would each be used?

D