View Single Post
  #3   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?

I'm calling 'getNextRow' and everytime it hits a blank row it calls itself
again.

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


"Bob Phillips" wrote in message
...
Why would you use recursion for the next blank row?

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Peter Chatterton" wrote in message
...
I'm writing macros under Excel 2003/XP on a fairly powerful PC to process
financial data.

When I'm searching an almost full column for the next non-blank entry I
don't have any problem using recursion, but when the column is mostly

blank
I wonder whether I'm doing the right thing.

Are there any guidelines for using recursion under VBA? I use instance
variables instead of locals, but that's about all I know.

Thanks for your help,
Peter