View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default row number within a named range

I would check the active cell is in the named range first

Sub sonic()
If Intersect(ActiveCell, Range("versions")) Is Nothing Then
MsgBox "The selected cell is not in the named range"
Else
With Range("versions")
irownumber = .Row
End With
MsgBox ActiveCell.Row - irownumber+1
End If
End Sub


Mike
"Werner Rohrmoser" wrote:

Hello,

I have a named range called "Versions" and it's located in "A10:A15".
When I select Range "A12" I get 12, when I use ActiveCell.Row.
What I'd like to know is the relative row in Range "Versions", which
would be 3.

What' s the syntax for it?
Thanks.

Regards
Werner

Excel XP SP3
Win XP SP1