View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Recursion in VBA macros?

A couple of things... One is that I would be inclined to avoid the instance
varables and stick with locals. The instance variables ( I assume you mean
globals) can be quite difficult to debug.

As for the first blank cell you can do that something like this

dim rng1 as range 'First blank
dim rng2 as range 'Last Blank

Sheets("Sheet1").select
set rng1= Sheets("Sheet1").Range("A1").end(xlDown)
msgbox rng1.address
set rng2 = Sheets("Sheet1").cells(rows.count, "a").end(xlUp).Offset(1,0)
msgbox rng2.address
--
HTH...

Jim Thomlinson


"Peter Chatterton" wrote:

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