View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
LooneyTunes LooneyTunes is offline
external usenet poster
 
Posts: 5
Default Find last used row in named range with data all around

Try this little snippet of code:

Sub FindLastRowInMyRange()

Dim rng As Range
Dim i As Integer

'to find the last used row in your named range _
regardless of where it is
Set rng = Range("hours")
i = rng.Rows(rng.Rows.Count).Row

'proof
MsgBox "The last used row within your named range is row: " & i


'to find the next row after your named range
i = i + 1
'proof
MsgBox "Start your next row he row " & i

End Sub

Good luck and happy programming

LooneyTunes



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!