Programatically nameing ranges

  • Thread starter Thread starter Adam Ward
  • Start date Start date
A

Adam Ward

I have a list in Cells A1:A(x)and C1:C(x)where (x) can
change, I know (x).

How do I programatically Name the Range

Thanks

Adam
 
Range("A1:A" & x).Name = "range1"

Range("C1:C" & x).Name = "range2"

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Thanks

But I also want the final named range to refer ,by one
name to all the cells in A1:A(x) and C1:C(x) but when I
do that

Range("A1:A" & (x), "C1:C" & (x)).Name = "range3"

I get returned A1:C(x)

I'm probably being very stupid here!

Adam
 
Adam,

Give this a try then

Union(Range("A1:A" & x), Range("C1:C" & x)).Name = "Bob1"

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
One of a few ways:

x = 10
Union([A1].Resize(x), [C1].Resize(x)).Name = "MyName"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top