Evaluate a Name in Non-active WB
Hi Dana,
It does work but only because I gave an inadequate example for testing.
v = .Item("abc") returns "=123" as the default refersto property of the
name. Then the Evaluate removes the = and returns a number.
I am reposting the question at extreme length!
Thanks for looking,
Peter T
"Dana DeLouis" wrote in message
...
Not sure, but does this work?
With ThisWorkbook.Names
'Return String "=123"
v = .Item("abc")
'Return Value 123
v = Evaluate(v)
End With
--
HTH :)
Dana DeLouis
"Peter T" <peter_t@discussions wrote in message
...
Anyone know the syntax to evaluate a Name in a Workbook that's not the
activeworkbook.
For example, in the following how to return v = 123 if ThisWorkbook is
NOT
the active workbook (without using cells).
Sub EvalNameTest()
Dim v
With ThisWorkbook.Names
.Add "abc", "=123"
v = [abc]
.Item("abc").Delete
End With
If IsError(v) Then
v = CStr(v)
End If
MsgBox v, , ActiveWorkbook.Name
End Sub
TIA, Peter T
|