ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Named Range is a formula (https://www.excelbanter.com/excel-programming/300124-named-range-formula.html)

cogent

Named Range is a formula
 
Hello

When a named range is a formula and not a range, how does one refer to it in
code.

Normally for example: workbook.worksheet.range("abc")

but since there is no sheet identified with the named range as formula i
cannot figure out how to call its value in the code.

Please help.

W



William[_2_]

Named Range is a formula
 
Hi cogent

Range("A1").formula = "=abc"

--
XL2002
Regards

William



"cogent" wrote in message
...
| Hello
|
| When a named range is a formula and not a range, how does one refer to it
in
| code.
|
| Normally for example: workbook.worksheet.range("abc")
|
| but since there is no sheet identified with the named range as formula i
| cannot figure out how to call its value in the code.
|
| Please help.
|
| W
|
|



Vasant Nanavati

Named Range is a formula
 
ThisWorkbook.Names("abc").RefersTo

This is not a range. It is just a named formula.

--

Vasant



"cogent" wrote in message
...
Hello

When a named range is a formula and not a range, how does one refer to it

in
code.

Normally for example: workbook.worksheet.range("abc")

but since there is no sheet identified with the named range as formula i
cannot figure out how to call its value in the code.

Please help.

W





Charles Williams

Named Range is a formula
 
Hi W

if you want the result of the named formula rather than the formula itself
then use Evaluate

if namedformula has a refersto of =5*2/3 you will get 3.3333 returned to
vArr

dim vArr as variant
varr=application.evaluate("NamedFormula")

or
varr=[NamedFormula]

for a general purpose wrapper function for Evaluate see
http://www.decisionModels.com/calcsecretsh.htm

regards
Charles
______________________
Decision Models
FastExcel Version 2 now available.
www.DecisionModels.com/FxlV2WhatsNew.htm

"cogent" wrote in message
...
Hello

When a named range is a formula and not a range, how does one refer to it

in
code.

Normally for example: workbook.worksheet.range("abc")

but since there is no sheet identified with the named range as formula i
cannot figure out how to call its value in the code.

Please help.

W






All times are GMT +1. The time now is 10:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com