Macro to Add Name Referring to Current Selection


Posted by Ben O. on October 27, 2000 9:25 AM

This sounds simple but I can't figure it out. I need to add a name that refers to my currently-selected range.

ActiveWorkbook.Names.Add Name:="Data", RefersToR1C1:=??????


-Ben

Posted by Ben O. on October 27, 2000 11:28 AM

Nevermind, I figured it out. (n/t)

Posted by Fred on October 27, 2000 4:04 PM

Re: Nevermind, I figured it out. (n/t)

Well, Ben - what *was* the answer? : This sounds simple but I can't figure it out. I need to add a name that refers to my currently-selected range. : ActiveWorkbook.Names.Add Name:="Data", RefersToR1C1:=?????? :



Posted by Ben O. on October 28, 2000 2:27 PM

Re: Nevermind, I figured it out. (n/t)

The spreadsheet is at work so I can't be sure that it's exactly this, but it's close:

Set NewName = Selection
ActiveWorkbook.Names.Add Name:="Data", RefersToR1C1:=NewName

-Ben Well, Ben - what *was* the answer?