Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default row number within a named range

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default row number within a named range

Sub marine()
MsgBox (ActiveCell.Row - Range("Versions").Row + 1)
End Sub

--
Gary''s Student - gsnu2007g
  #4   Report Post  
Posted to microsoft.public.excel.programming
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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default row number within a named range

Thanks for all the suggestions.

Werner
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using named range to extend print area for variable number of columns Pierre Excel Worksheet Functions 3 April 10th 08 05:51 PM
Last Row Number in a Named Range David Excel Worksheet Functions 6 May 7th 07 02:11 AM
VBA: find number of columns in named range? George[_3_] Excel Discussion (Misc queries) 3 April 30th 07 05:35 PM
Number of Rows & Columns in a Named Range Michael Excel Dude Excel Discussion (Misc queries) 0 September 3rd 06 11:05 PM
How to count number of pages in a named range rm81 Excel Programming 2 June 9th 06 05:49 PM


All times are GMT +1. The time now is 06:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"