![]() |
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 |
row number within a named range
Sub marine()
MsgBox (ActiveCell.Row - Range("Versions").Row + 1) End Sub -- Gary''s Student - gsnu2007g |
row number within a named range
Maybe?
MsgBox ActiveCell.Row - Range("d5:d10").Cells(1).Row+1 -- Don Guillett Microsoft MVP Excel SalesAid Software "Werner Rohrmoser" wrote in message ... 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 |
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 |
row number within a named range
Thanks for all the suggestions.
Werner |
All times are GMT +1. The time now is 12:32 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com