Select Last cell in named range VBA

dimitri

Board Regular
Joined
Nov 8, 2010
Messages
78
Hi,
I'm looking for the VBA code that will select the last cell in named range. I can select the first cell by using this code:
Code:
Range("NamedRange")(1).select

But i don't know how to select the last cell. What I ultimately want to do is insert 2 rows above the last cell in my named range.

Thanks.
 
Last edited:
I know this is an older post, but I came across it while looking for something else. I noticed several answers but none that seemed quite as simple as this. You had asked how to select the last cell in a named range and referenced your code to select the first cell. Anyway, for what it is worth a little over two years later, to select the last row in a named range do this.

Code:
Range("[COLOR=#574123]NamedRange[/COLOR]")(Range("[COLOR=#574123]NamedRange[/COLOR]").Count).Select

It seems to work for me anyway; and it doesn't matter if there are blank cells in this list or not.
 
Upvote 0

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,215,527
Messages
6,125,337
Members
449,218
Latest member
Excel Master

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