ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cell vales (https://www.excelbanter.com/excel-programming/433922-cell-vales.html)

Mike

Cell vales
 
I am trying in a macro to check if a cell in a work sheet is NOT blank.

Rick Rothstein

Cell vales
 
Test its Value property for not being the empty cell...

If Range("A1").Value < "" Then

or, alternately, test the length of the Value for being larger than zero...

If Len(Range("A1").Value) 0 Then

--
Rick (MVP - Excel)


"Mike" wrote in message
...
I am trying in a macro to check if a cell in a work sheet is NOT blank.



Dave Peterson

Cell vales
 
If you want to look for an empty cell -- no formula that evaluates to "".

if isempty(worksheets("Somesheetnamehere").range("A1" ).value) then
'it's empty
else
'it's got something in it.
end if

checking for "" with something like this may not be enough:

if worksheets("Somesheetnamehere").range("A1").value = "" then
'cell looks empty, but it may have a formula that evaluates to ""
'it may even be empty
else
'cell has something in it for sure
end if



Mike wrote:

I am trying in a macro to check if a cell in a work sheet is NOT blank.


--

Dave Peterson


All times are GMT +1. The time now is 12:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com