Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
check for empty cell | Excel Programming | |||
How do I check for an empty cell in a formula? | Excel Discussion (Misc queries) | |||
Check if empty | Excel Programming | |||
How to check for next empty cell in list | Excel Programming | |||
vba - check if cell is empty | Excel Programming |