MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Defining range names

Posted by Ian Bartlett on February 24, 2001 11:40 AM

I wish to use a macro to assign a range name to a column of figures of variable length; using the macro recorder results in a specific number of cells being defined in the code, as follows:

Range(Selection, Selection.End(xlDown)).Select
ActiveWorkbook.Names.Add Name:="Date", RefersToR1C1:="=Data!R8C8:R14C8"

Can I replace "=Data!R8C8:R14C8" with the current selection?

Many thanks,


Posted by David Hawley on February 24, 2001 3:18 PM

You sure can Ian. Try this:

Selection.Name = "Date"


OzGrid Business Applications

Posted by Ian Bartlett on February 25, 2001 1:30 AM

Many thanks Dave,

Worked a treat.