![]() |
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 |
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 . |
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 |
All times are GMT +1. The time now is 03:03 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com