Returning the position of the Cellpointer in the range

J

John

Hi,

The Table below is called Tbl_AgeProfile. I'd like to be able to return
the row and column offset of the Cellpointer from R1. EG if the Cellpointer
is highlighting the cell with the value 91, i want to return 5,4 where 5 is
the row down and 4 is the column across. Any ideas please?

Thanks

John

R1 R2 R3 R4 R5 R6
2 20 418 590 135 29
0 11 74 189 68 3
2 8 51 95 85 3
1 11 53 91 27 4
2 14 16 75 14 1
0 16 14 135 31 1
1 5 0 0 0 0
 
C

Chip Pearson

Try something like

Dim R As Long
Dim C As Long
R = ActiveCell.Row - Range("Tbl_AgeProfile")(1, 1).Row
C = ActiveCell.Column - Range("Tbl_AgeProfile")(1, 1).Column
Debug.Print R, C


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)
 
J

John

Hi Chip,

Cool, thanks

John

Chip Pearson said:
Try something like

Dim R As Long
Dim C As Long
R = ActiveCell.Row - Range("Tbl_AgeProfile")(1, 1).Row
C = ActiveCell.Column - Range("Tbl_AgeProfile")(1, 1).Column
Debug.Print R, C


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top