View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
PerlDev PerlDev is offline
external usenet poster
 
Posts: 7
Default Why can't name the range?

I try to name a range as follows:

dim rng as Range, v as String
set rng = LookupSomeRange( v ) 'where LookupSomeRange is a function,
returns range

'now name it, bur has run-time error '1004', the name is not valid

ActiveSheet.Names.add Name:= v, RefersToR1C1="""=" & ActiveSheet.Name
& "!" & v & """", Visible:=True

' i am sure the value of v is unique, there is no name conflict

What went wrong?

-PD