View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Xxer Xxes Xxer Xxes is offline
external usenet poster
 
Posts: 33
Default Need a UDF to count blank cells

I tried to work with that functions , but I realize i need
3 UDF ;

1) Function countnull()
Dim X
Application.Volatile
If TypeName(Application.Caller) = "Range" Then
For X = Application.Caller.Row - 1 To 1 Step -1
If Cells(X, Application.Caller.Column).Formula = vbNullString Then
countnull = countnull + 1
Else
Exit Function
End If
Next X
End If
End Function

what is doing this udf in a column , to do it in a row , counting
in the same row , on left side ;

2) second udf : instead to count empty cells ( untill udf find a cell non empty)
and return number of count empty cells , to do tha same loop and count
untill find value 3 ( number three )
- - - - -
i.ll try to make some exemples ;
for 1 ask): now , this formula return so :
in Column C , cell C1 for eg i have value 1 ; C2 ,C3 ,C4 , C5 are empty :introduceing in cell
C5 my actually udf , returns value 4 , and is correct ; it ehows me there are 4 cells
"consecutivelly " empty , before to find the cell C1 , which is not empty ;
well ,now i need to do tha same task , in a Row , not in a column , as i said ,
"to the left " . so , the results of this new udf will be :

assume we have in Row10 , column B , we have value 2 ( the mean is cell is not empty );
c10 and d10 is empty ;
in the same row ( we work with only one row in this udf ) , Column E ,we put this new formula ;
the result must to be 2 ; if in cell d10 is any value , in e10 the result displaied will be 0
( zero ) .
- - - - - -
For second demand ) : udf to count untill find a value , 3 for eg. ignoring wether cells are
empty or not