View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Peter Chatterton[_4_] Peter Chatterton[_4_] is offline
external usenet poster
 
Posts: 20
Default Recursion in VBA macros?

Thanks, that's much better than recursion.
Peter

"JE McGimpsey" wrote in message
...
That's incredibly inefficient, given the overhead that calling a
function requires. It also requires tons of stack space.

A simpler function would be:

Public Function getNextRow() As Boolean
For lRow = lRow + 1 To lMaxRow
If rFundNameCol.Cells(lRow).Value < vbNullString Then Exit For
Next lRow
getNextRow = lRow <= lMaxRow
End Function


In article ,
"Peter Chatterton" wrote:

Public Function getNextRow() As Boolean
lRow = lRow + 1
If lRow <= lMaxRow Then
getNextRow = True
Set r = rFundNameCol.Cells(lRow)
s = r
If s = "" Then _
getNextRow
Else
getNextRow = False
End If
End Function