View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default UDF ...VBA Formula built ...please help

First, you should put back the "Exit function" to speed up the code. Once
you find one row that is greater than 1 you don't need to test all the other
rows.

Second, it doesn't make sence that the columns work and the Rows don't work.
It must mean that you have two items in one Row but not two items in one
column.

Third, there is an equivalent Count function in VBA to the worksheet
function. It will run a little quicker, but probably not noticable.

Function CountUDF(Target As Range)
CountUDF = True
For RowCount = 1 To Target.Rows.Count
MyCount = Target.Rows(RowCount).Count
If MyCount 1 Then
CountUDF = False
Exit Function
End If
Next RowCount
End Function

"ytayta555" wrote:

HI EVERYBODY AGAIN !

Last days I worked with this UDF .This UDF with worksheetfunction
don't
work : Try calling function below with
=CountUDF(R1:BB15)

Function CountUDF(Target As Range)
CountUDF = True
For RowCount = 1 To Target.Rows.Count
MyCount = WorksheetFunction.Count(Target.Rows(RowCount))
If MyCount 1 Then
CountUDF = False
'Exit Function
End If
Next RowCount
End Function

It work perfect in the next variant :

Function CountUDF(Target As Range)
Application.Volatile
CountUDF = True
For ColCount = 1 To Target.Columns.Count
MyCount = WorksheetFunction.Count(Target.Columns(ColCount))
If MyCount 1 Then
CountUDF = False
'Exit Function
End If
Next ColCount
End Function (I changed Row with Column and work perfect)

With my array function , an autofill from BD91 to BD65536 take 65
seconds ;
with this UDF with worksheetfunction inside , take 27 seconds (it's
great!)

The example of UDF without worksheetfunction inside , don't work !
Please
very much everybody to provide me the changes in it to get it work ,
because
work more more fast ( see
http://newtonexcelbach.wordpress.com...etfunction-vs-...
)

(In a perfect world I'd want so much to be with an array , according
with
the ideas and experiment of here :( see please
http://www.dailydoseofexcel.com/arch...mance-monitor/
to Doug Jenkins comment ) .

Please everybody to help me , I'm so nearby to get what I need and
want so much !
Thanks very much to all