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: 11,058
Default Best way to check if cell is empty??

You do not need the .Value

However if the cell contains a Comment it Isempty() will still return True.
--
Gary''s Student - gsnu200909


"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



.

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

Option Explicit
Sub checkcell()'Even takes care of touching the space bar
If Len(Application.Trim(Sheet1.Range("a1"))) < 1 Then
MsgBox "hi"
End If
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Robert Crandal" wrote in message
...
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




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
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
Check if empty stevenmckeon[_4_] Excel Programming 2 August 2nd 04 08:29 AM
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 08:14 AM.

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

About Us

"It's about Microsoft Excel"