Get the row and column of a range address

TomPC

Board Regular
Joined
Oct 13, 2011
Messages
95
Example range: "A1:D9"

Is there a smarter way of getting the last row (9) and last column (D=4) of a range address than:

Code:
range(mid(selection.address,instr(1,selection.address,":")+1,200)).Row
range(mid(selection.address,instr(1,selection.address,":")+1,200)).Column

I'm hoping for some nice object-based solution like:
Code:
selection.TheLastRowInTheUniverse
 

Some videos you may like

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try like this

Code:
MsgBox Selection.Row + Selection.Rows.Count - 1
 

jasonb75

Well-known Member
Joined
Dec 30, 2008
Messages
11,903
Office Version
  1. 365
Platform
  1. Windows
Or

Code:
With Selection
    MsgBox .Offset(.Rows.Count - 1).Row
    MsgBox .Offset(, .Columns.Count - 1).Column
End With
 

Watch MrExcel Video

Forum statistics

Threads
1,122,418
Messages
5,596,028
Members
414,039
Latest member
southike

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
Top