Thread: UsedRange?
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default UsedRange?

For each cell in UsedRange 'Step UsedRange
If Cell < "" Then
'Use Cell as the object not activecell
'my later procedures go here....

end if

Next cell




"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.