activecell column/row within range

schanjc

New Member
Joined
May 27, 2011
Messages
2
apologies if this has already been solved on this board, but I wasn't able to find anything like this after a searching around.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p></o:p>
I've established whether my activecell intersects a range, but now I need to know the row and cell the active cell falls within the range.<o:p></o:p>
<o:p></o:p>
For Example Cell "C3" is my active cell<o:p></o:p>
named Range address is "B2:C10"<o:p></o:p>
<o:p></o:p>
the procedure should identify Row=2 column=2.<o:p></o:p>
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Something like this perhaps.
Code:
Dim colWithinRng As Long
Dim rowWithinRng As Long
Dim strName As String
 
    strName = "Named"

    If Not Intersect(ActiveCell, Range(strName)) Is Nothing Then
        colWithinRng = ActiveCell.Column - Range(strName).Cells(1, 1).Column + 1
        rowWithinRng = ActiveCell.Row - Range(strName).Cells(1, 1).Row + 1
    End If
 
    MsgBox "Active cell is in row " & rowWithinRng & ", column " & colWithinRng & " of named range " & strName
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,289
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top