PDA

View Full Version : Dynamically referencing multiple named ranges



Johan90
06-28-2018, 02:03 AM
Hi

I need to select multiple named ranges and I want to use a formula in a cell that can remove a single or multiple items from that list. I am printing a report and need to be able to cut out a page if I need to. I have named the ranges as Page1 to PageX. Like in this code line I only want one reference that dynamically changes the number of page references it needs to select.

Hope this make sense, tried searching around but couldnt really find a good guide for what I need.

This

Range("Page1, Page2, Page3, Page4, Page5, Page6, Page7, Page8")



To something like this, were Pages is a combination of the selected pages to print

Range("Pages")

p45cal
06-28-2018, 11:41 AM
Perhaps something along these lines:
Range("Page1, Page2, Page3, Page4, Page5, Page6, Page7, Page8").Name="Pages"
Range("Pages").Select
?
Edit post posting: I see I've probably got this wrong, supply a little workbook with a few named ranges in and put something in a cell(s) that you might like to see as a formula.