Thread: UsedRange?
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Aaron Aaron is offline
external usenet poster
 
Posts: 287
Default UsedRange?

Hi Steve,

Check this out,
http://www.tek-tips.com/faqs.cfm?fid=2112

I use this for usedrange...I find it more reliable

Maybe you could alter the function to get it to return your last row and
lastcoumn or even return the last cell(lowest and most right cell) by
concatenating the lastrow and lastcolumn strings

And then your For loop could become something like,

For i=0 to LastRow
ActiveCell.Offset(rowoffset:=1, columnoffset:=0).Activate
...rest of code
Next i

Hopefully this is something like what you were looking for
--
Aaron

"Steve" wrote:

morning all.
I'm trying to modify an old macro that iterates through a UsedRange of cells.
My code is:

If ActiveCell < "" Then
For i = 0 To UsedRange 'Step UsedRange

ActiveCell.Offset(rowoffset:=1, columnoffset:=0).Activate

'my later procedures go here....

Next i

End If

So far, this only steps 1 cell, and stops. I need it to step through all
cells in a used range. However, when I use "Step UsedRange" it runs out to
the very end of the worksheet--- 1mRows.
When I check the actual used rows, it stops at row 287. I.e., I did ctrl +
End, and that's where it stopped.
My UsedRange will vary from worksheet to worksheet.
What am I doing wrong here?
Thank you, in advance.