Reference a workbook level named variable.
Hello,
I have a situation where 2 workbooks are open simultaneously, and I’m trying to reference a named variable (workbook scope) in the inactive workbook.. While experimenting I ran into this.
Dim w As Workbook
Dim s As Worksheet
Set w = ThisWorkbook
Set s = w.Sheets("sheet1")
w.Names.Add ("Bk"), 99
s.Names.Add ("Sht"), 98
Debug.Print s.[sht] 'this works
Debug.Print w.[Bk] 'this raises an error
End Sub
I must be missing something simple, but for the life of me, I can’t figure out why w.[bk] is raising an error. Appreciate any help on this.
Regards,
DaveU
|