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 Find last used row in named range with data all around

This is specific to your range:

Sub venus()
For i = 53 To 3 Step -1
If Application.CountA(Range(Cells(i, "C"), Cells(i, "P"))) 0 Then
Exit For
End If
Next
MsgBox ("Row " & i & " has data")
End Sub

You don't need to use the name of the range.

--
Gary's Student


"venus" wrote:

Hi,

I'm fairly good with Excel, but new to vba (I barely know what I'm
doing). I have a named range of cells c6:p53, named Hours. There is
data all around this range. I want to find the last used row within
this range and have had no luck.

Almost every solution I've found just gets me the very last row of the
worksheet instead of the range. There is a thread with a solution from
Jim Thomlinson, but I get an "invalid qualifier" error when I use it. I
have looked for days on the net and when I find code that should work,
it doesn't. What's wrong with me and my pc?

Someone, please help me!