Finding Row & Column of selection relative to named range

BobFast

New Member
Joined
Mar 31, 2010
Messages
12
I have a chart of names, 12 rows by 4 columns. I have named this range PLAYERS. I would like to select a name and have the vba code populate variables with the row number and column number relative to the named range. The range PLAYERS does not start at A1, but rather is in the middle of the worksheet.
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Code:
Range("PLAYERS").Cells(1, 1)
returns the upper left cell of the range. You can use Offset to populate the target cell, e.g.,

Code:
Range("PLAYERS").Cells(1, 1).Offset(0, 4) = "Test"
 
Upvote 0
Thanks, that's helpful but I really want to know the column number and the row number of the selected cell in PLAYERS, so I can use those numbers to refer to the team that the player is on and determine if that player is a 1, 2, 3 or 4 player. Once I know that I can run several other routines to move records around.
 
Upvote 0
Is this what you need?
Code:
RelRow = ActiveCell.Row - Range("PLAYERS").Row + 1
RelCol = ActiveCell.Column - Range("PLAYERS").Column + 1
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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