View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Erik Oveson [MSFT] Erik Oveson [MSFT] is offline
external usenet poster
 
Posts: 3
Default Insert named range problem

Hi FinChase,

Try:

RefersTo := ActiveCell

Or for any other cell just use, e.g.:
RefersTo := [B45]

-Erik


--
This posting is provided "AS IS" with no warranties, and confers no rights.

"FinChase" wrote in message
...
I want to be able to insert a named range using an A1 reference based on
the
activecell using VBA. Based on Help, I tried the following code:

With ActiveWorkbook
.Names.Add Name:="Hold1", RefersTo:=RefersToLocal
End With
It does insert a name, but the range it refers to is #N/A. Is there a way
to do this so that it actually refers to the cell (for example, =B45)?