Evaluate a Name in Non-active WB
Hi
This syntax seems to work
With Workbooks("Test2.xls").Names
.Add "abc", "=124"
v = .Item("abc").Value
.Item("abc").Delete
End With
but this one does not
With Workbooks("Test2.xls").Names
.Add "abc", "=124"
v = [abc]
.Item("abc").Delete
End With
i don't know why not. Anyone?
regards
Paul
On Mar 4, 11:45*am, "Peter T" <peter_t@discussions wrote:
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
|