ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   empty cell (https://www.excelbanter.com/excel-programming/349836-empty-cell.html)

רוזנט

empty cell
 
one way to chek if is empty cell in column is
by dividinge the count cells in the rows in the column

i tried to build a code like this:

if counta(XXX)/rows(XXX)<1 then
do .....
else
.......
it didn't work
i ask you to help me only by this way
i think this code is wrong becuse of the dividing sign

thank you
rozent

Greg Wilson

empty cell
 
Try:

Sub FindEmpty()
Dim r As Range
Set r = Range("A6:A26") 'Change to suit
If Application.CountA(r) / r.Count < 1 Then
MsgBox "Range has empty cell(s)"
Else
MsgBox "No empty cells in range"
End If
End Sub

Sub FindEmpty2()
Dim r As Range
Dim NumEmpty As Long
Set r = Range("A6:A26") 'Change to suit
NumEmpty = r.Count - Application.CountA(r)
MsgBox NumEmpty
End Sub

Regards,
Greg

"רוז×*ט" wrote:

one way to chek if is empty cell in column is
by dividinge the count cells in the rows in the column

i tried to build a code like this:

if counta(XXX)/rows(XXX)<1 then
do .....
else
......
it didn't work
i ask you to help me only by this way
i think this code is wrong becuse of the dividing sign

thank you
rozent


Bob Phillips[_6_]

empty cell
 
Sub FindEmpty()
Dim r As Range
Set r = Range("A6:A26") 'Change to suit
If Application.CountBlank(r) 1 Then
MsgBox "Range has empty cell(s)"
Else
MsgBox "No empty cells in range"
End If
End Sub


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Greg Wilson" wrote in message
...
Try:

Sub FindEmpty()
Dim r As Range
Set r = Range("A6:A26") 'Change to suit
If Application.CountA(r) / r.Count < 1 Then
MsgBox "Range has empty cell(s)"
Else
MsgBox "No empty cells in range"
End If
End Sub

Sub FindEmpty2()
Dim r As Range
Dim NumEmpty As Long
Set r = Range("A6:A26") 'Change to suit
NumEmpty = r.Count - Application.CountA(r)
MsgBox NumEmpty
End Sub

Regards,
Greg

"?????" wrote:

one way to chek if is empty cell in column is
by dividinge the count cells in the rows in the column

i tried to build a code like this:

if counta(XXX)/rows(XXX)<1 then
do .....
else
......
it didn't work
i ask you to help me only by this way
i think this code is wrong becuse of the dividing sign

thank you
rozent





All times are GMT +1. The time now is 11:41 PM.

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