Why can't name the range?
with rng
.name = "'" & .parent.name & "'!" & v
end with
The apostrophes may be required depending on the worksheet name.
And if this doesn't work, what does V hold?
(Even if v is used before, your code won't mind--it'll just reuse it.)
PerlDev wrote:
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
--
Dave Peterson
|