Hello,
I'm using Excel 2003 on XP Pro.
I'm creating a basic user form which will allow users to view and edit key variables in a large workbook. The workbook uses defined names for these variables.
When I assign the value of a defined name with a certain format to a text box, I receive an error message. This appears to only happen with defined names that include 2 or more underbars (e.g. _2011_Tax). Names with one underbar (e.g., _2011Rev) work fine.
-----
a = Evaluate(ThisWorkbook.Names("_2011Rev").RefersTo)
UserForm1.TextBox1.Value = a
(This works fine)
-----
b = Evaluate(ThisWorkbook.Names("_2011_Tax").RefersTo)
UserForm1.TextBox2.Value = b
(This fails with an error of: )
Run-time error '-2147352571 (80020005)':
Could not set the Value property. Type mismatch.
-----
Has anyone ever seen this? The defined names function fine in the worksheets, just not with VBA. What am I missing?
Any help appreciated,
Thanks,
Brian
PS - Its been awhile since I've used VBA...
I'm using Excel 2003 on XP Pro.
I'm creating a basic user form which will allow users to view and edit key variables in a large workbook. The workbook uses defined names for these variables.
When I assign the value of a defined name with a certain format to a text box, I receive an error message. This appears to only happen with defined names that include 2 or more underbars (e.g. _2011_Tax). Names with one underbar (e.g., _2011Rev) work fine.
-----
a = Evaluate(ThisWorkbook.Names("_2011Rev").RefersTo)
UserForm1.TextBox1.Value = a
(This works fine)
-----
b = Evaluate(ThisWorkbook.Names("_2011_Tax").RefersTo)
UserForm1.TextBox2.Value = b
(This fails with an error of: )
Run-time error '-2147352571 (80020005)':
Could not set the Value property. Type mismatch.
-----
Has anyone ever seen this? The defined names function fine in the worksheets, just not with VBA. What am I missing?
Any help appreciated,
Thanks,
Brian
PS - Its been awhile since I've used VBA...