Select named range with VBA?

Mr2017

Well-known Member
Joined
Nov 28, 2016
Messages
644
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi

I have a tab where I'd like to refer to the cells using named ranges instead of absolute references.

So, for example, I currently use this to select cell I8 then clear it, but

VBA Code:
'clear cell I8
'Range("I8").Select
Selection.ClearContents

But I'd like to use this instead (assuming that the range for that cell is simply called 'First_Cell') I'd prefer to use a named range in case someone inserts a column, which would mean that the code would then delete the data in the wrong cell.

However, this code didn't work, as expected. Does anyone know the easiest way to modify this? TIA

VBA Code:
'clear cell I8 
Range.First_Cell.Select
Selection.ClearContents
 

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.
There is no need to select it - you can just use:

Code:
Range("First_Cell").ClearContents
 
Upvote 0

Forum statistics

Threads
1,214,823
Messages
6,121,780
Members
449,049
Latest member
greyangel23

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