Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 309
Default Best way to check if cell is empty??

I currently use the following code to test if a cell is empty:

If IsEmpty(Sheet1.Range("A1").Value) then
' code here
End If

Are there better or other ways to check if a cell is empty???
Also, does it matter if I put the ".Value" at the end of the
Range("A1") code?

thankx



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Best way to check if cell is empty??

You don't need the .value, but then you're relying on the default property for
that range (which is .value).

The same way you don't need the .value he

activesheet.range("A1") = "hi there"

Personally, I think it's much better to include the property--I think it
documents the code better.

And that's the way I'd check to see if the cell were really empty.

If you only cared about what you saw in the cell (a formula could evaluate to
""), you could use:

if sheet1.range("a1").value = "" then

But that really doesn't test for emptiness.

Robert Crandal wrote:

I currently use the following code to test if a cell is empty:

If IsEmpty(Sheet1.Range("A1").Value) then
' code here
End If

Are there better or other ways to check if a cell is empty???
Also, does it matter if I put the ".Value" at the end of the
Range("A1") code?

thankx


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Best way to check if cell is empty?? Robert Crandal Excel Programming 2 December 23rd 09 01:26 PM
check for empty cell ingalla Excel Programming 1 May 3rd 07 12:09 AM
How do I check for an empty cell in a formula? sasquatchbill Excel Discussion (Misc queries) 4 August 8th 06 03:55 PM
How to check for next empty cell in list DonW Excel Programming 3 December 27th 03 05:47 AM
vba - check if cell is empty joao Excel Programming 6 November 18th 03 03:12 PM


All times are GMT +1. The time now is 11:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"