Isempty syntax

bobkap

Active Member
Joined
Nov 22, 2009
Messages
313
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
  3. Web
I cannot seem to figure out how to use range with cells when using the Isempty function. Using the code below works fine. But I want to use cells instead of range and every thing I've tried bombs out.

For example something like 'If IsEmpty Range(cells(1,1), cells(1,1)) = True Then' never works. Or, if I delete the range completely, adjust the parens and go with just the cells. That doesn't work either.

Are we not supposed to use the cells function with isempty? Or, is my syntax just wrong?

If IsEmpty(Range("A1")) = True Then
MsgBox "Cell A1 is empty"
Else
MsgBox "Cell A1 is NOT Empty"
End If
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Within the last day or two I read that Cells is a property of a range; it's not an object - thus you can't use IsEmpty on it.
EDIT - but this works
IsEmpty(Cells(1,1))

and so does this

IsEmpty(Cells(1,1) & ":" & cells(1,1))

Don't forget that it only takes one cell in a range to make it False.
 
Last edited:
Upvote 0
Solution
Within the last day or two I read that Cells is a property of a range; it's not an object - thus you can't use IsEmpty on it.
EDIT - but this works
IsEmpty(Cells(1,1))

and so does this

IsEmpty(Cells(1,1) & ":" & cells(1,1))

Don't forget that it only takes one cell in a range to make it False.
THANKS very much!!
 
Upvote 0
Range ("A1") or Range(Cells(1,1),Cells(1,1)) exact the same
also
Range ("A1:B1") or Range(Cells(1,1),Cells(1,2)) exact the same
But, if using ISEMPTY with range of cells (more than 1 cell), its problem. It require loop for each cell.
I tried to test as below image:

1651947359349.png
 
Upvote 0
Not sure what post 4 means but I can say that if A1 and A2 are as follows ( or both contain TEST, or only A1 contains TEST)

TEST
?IsEmpty(Cells(1,1)& ":" & cells(1,2)) returns
False
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,803
Members
449,048
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top