Thread: Last used row
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Last used row

Try:

Sub Find_lur()
Dim j, i, k As Long
' gsnu find last used row
k = 0
j = 65536
For i = j To 1 Step -1
If Application.CountA(Rows(i)) = 0 Then
Else
k = i
Exit For
End If
Next i
MsgBox (k)
End Sub
--
Gary''s Student


" wrote:

I need to loop through all the rows on a worksheet ...

There are patches where there are groups of existing but unused rows
....

How do I get the last used row in VBA?

Thanks.