ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Test if there is data in a cell or not? (https://www.excelbanter.com/excel-programming/387392-test-if-there-data-cell-not.html)

J@Y

Test if there is data in a cell or not?
 
What function can be used to test if there is data in a cell or not?

Mike

Test if there is data in a cell or not?
 
Paste this into a worksheet module and click around

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If ActiveCell.Value = "" Then
MsgBox "No data here"
Else
MsgBox "Cell contains " & Cells(1, 1).Value

End If
End Sub

Mike

"J@Y" wrote:

What function can be used to test if there is data in a cell or not?


Mike

Test if there is data in a cell or not?
 
=IF(A1<"","Data in celll.","No Data in cell")

"J@Y" wrote:

What function can be used to test if there is data in a cell or not?


Dave Peterson

Test if there is data in a cell or not?
 
Maybe...

=if(a1="","it looks empty","something's there")

But if A1 contained a formula like:
=if(b2=7,"0k,"")
and evaluated to "", then it would look empty.



J@Y wrote:

What function can be used to test if there is data in a cell or not?


--

Dave Peterson

Dave Peterson

Test if there is data in a cell or not?
 
And in code, you can check to see if the cell is empty--no value and no formula:

if isempty(activesheet.range("a1").value) then
'it's empty
else
'it's got a value or formula
end if



J@Y wrote:

What function can be used to test if there is data in a cell or not?


--

Dave Peterson

J@Y

Test if there is data in a cell or not?
 
Thank you guys!

J@Y

Test if there is data in a cell or not?
 
Thank you guys!


All times are GMT +1. The time now is 12:27 AM.

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