Syntax advice

  • Thread starter Thread starter Terry von Gease
  • Start date Start date
T

Terry von Gease

Assume a named range "my_rng"

One can say: Range("my_rng")(5)
One can say : [my_rng].cells(5)
One can say: Evaluate("my_rng")(5)
But one cannot say: [my_rng](5)

Why is that?

--
Terry

"I said I never had much use for one,
I never said I didn't know how to use one."
M. Quigley
 
Because Excel doesn't parse out []( ) as anything meaningful would be my
guess.
Still, I don't know why you would use anything besides

Range("my_rng")(5)
 
From the On-line help I would have expected ["my_rng"](5) to work, but
it doesn't either.

Alan Beban

Tom said:
Because Excel doesn't parse out []( ) as anything meaningful would be my
guess.
Still, I don't know why you would use anything besides

Range("my_rng")(5)



--
Regards,
Tom Ogilvy


Assume a named range "my_rng"

One can say: Range("my_rng")(5)
One can say : [my_rng].cells(5)
One can say: Evaluate("my_rng")(5)
But one cannot say: [my_rng](5)

Why is that?

--
Terry

"I said I never had much use for one,
I never said I didn't know how to use one."
M. Quigley
 
Because I loathe typing and each keystroke increases the probability of
malfeasance.

But the curiosity here is that 'Evaluate("my_rng")(5)' works and, as per the
documentation, '[expression]' is a shortcut format for
'Evaluate("expression")', it would not be unreasonable to expect
'[my_rng](5)' to work as well.

Go figure....

--
Terry

"I said I never had much use for one,
I never said I didn't know how to use one."
M. Quigley

Tom Ogilvy said:
Because Excel doesn't parse out []( ) as anything meaningful would be my
guess.
Still, I don't know why you would use anything besides

Range("my_rng")(5)



--
Regards,
Tom Ogilvy


Terry von Gease said:
Assume a named range "my_rng"

One can say: Range("my_rng")(5)
One can say : [my_rng].cells(5)
One can say: Evaluate("my_rng")(5)
But one cannot say: [my_rng](5)

Why is that?

--
Terry

"I said I never had much use for one,
I never said I didn't know how to use one."
M. Quigley
 
? ["my_rng"]
my_rng

It just evaluates the string constant "my_rng" to a string - doesn't see it
as a range name.

--
Regards,
Tom Ogilvy

Alan Beban said:
From the On-line help I would have expected ["my_rng"](5) to work, but
it doesn't either.

Alan Beban

Tom said:
Because Excel doesn't parse out []( ) as anything meaningful would be my
guess.
Still, I don't know why you would use anything besides

Range("my_rng")(5)



--
Regards,
Tom Ogilvy


Assume a named range "my_rng"

One can say: Range("my_rng")(5)
One can say : [my_rng].cells(5)
One can say: Evaluate("my_rng")(5)
But one cannot say: [my_rng](5)

Why is that?

--
Terry

"I said I never had much use for one,
I never said I didn't know how to use one."
M. Quigley
 
Back
Top