select cells

buzz71023

Active Member
Joined
May 29, 2011
Messages
295
Office Version
  1. 2016
Platform
  1. Windows
Is there a way to select a range between two cells with a defined name? For example, i have a two named cells (notes1 and notes2) that are not always in the same place (columns are added between the two, but between those ranges i need to select everything (not including the two named ranges).
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Sheets("Data Sheet").Select
Range(Range("Notes1").Offset(0), Range("Notes").Offset(-1)).Select

this is what i have but it is selecting the named cells
 
Upvote 0
Try

Rich (BB code):
Sheets("Data Sheet").Range(Range("Notes1").Offset(,1), Range("Notes").Offset(,-1)).Select

Do you really need to select? It's inefficient, most actions can be carried out directly without selection.
 
Upvote 0
for some reason it is selecting the entire named range of Notes, the other part is working correctly, it did offset to the right of notes1.
 
Upvote 0
Are there any merged cells that span Notes and the column to the left?
 
Upvote 0
No, the only merged cells are the ranges of notes1 (c2,g3 and will always be that range) and notes (changes with every column added, but for the sake of the example ill say it is m2,g3).
 
Upvote 0
No, the only merged cells are the ranges of notes1 (c2,g3 and will always be that range) and notes (changes with every column added, but for the sake of the example ill say it is m2,g3).
It looks like there may be a typo in the formula...

Code:
Sheets("Data Sheet").Range(Range("Notes1").Offset[COLOR=black](,1[/COLOR]), Range("Notes[SIZE=3][COLOR=red][B]2[/B][/COLOR][/SIZE]").Offset([COLOR=black],[/COLOR]-1)).Select
Add the 2 shown in red and I think the formula will work for you.
 
Upvote 0
it didnt select both the rows, just the top row but it did select between the two rows this time and that will work if need be, but I was just hoping for both rows to be selected. its just odd that even worked at all bc i dont have a range named Notes2. But thank you for your help so far.
 
Upvote 0
How do you have the named ranges defined? Is it done by formula or direct reference to the cells?

When you say c2,g3 do you mean it only refers to 2 cells, or it refers to c2:g3?
 
Upvote 0

Forum statistics

Threads
1,215,400
Messages
6,124,702
Members
449,180
Latest member
craigus51286

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