ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Getting the entry of a Named Range (https://www.excelbanter.com/excel-programming/440975-getting-entry-named-range.html)

Brad E.

Getting the entry of a Named Range
 
I have a Named Range called VERSION, in which I update every time I make a
new version of the workbook. In my macro, I want to grab this value.

ThisWorkbook.Names("VERSION").Value returns "=UPDATES!$D$16".

How should I change that line to return the value which is Cell D16 on my
UPDATES tab?
--
TIA, Brad E.

Mike H

Getting the entry of a Named Range
 
Brad,

To get the value use

MyVar = ThisWorkbook.Names("Version").RefersToRange
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Brad E." wrote:

I have a Named Range called VERSION, in which I update every time I make a
new version of the workbook. In my macro, I want to grab this value.

ThisWorkbook.Names("VERSION").Value returns "=UPDATES!$D$16".

How should I change that line to return the value which is Cell D16 on my
UPDATES tab?
--
TIA, Brad E.


RonaldoOneNil

Getting the entry of a Named Range
 
ThisWorkbook.Names("VERSION").RefersToRange

"Brad E." wrote:

I have a Named Range called VERSION, in which I update every time I make a
new version of the workbook. In my macro, I want to grab this value.

ThisWorkbook.Names("VERSION").Value returns "=UPDATES!$D$16".

How should I change that line to return the value which is Cell D16 on my
UPDATES tab?
--
TIA, Brad E.


Roger Govier[_8_]

Getting the entry of a Named Range
 
Hi Brad

try
evaluate(thisworkbook.names("VERSION").value)

--
Regards
Roger Govier

Brad E. wrote:
I have a Named Range called VERSION, in which I update every time I make a
new version of the workbook. In my macro, I want to grab this value.

ThisWorkbook.Names("VERSION").Value returns "=UPDATES!$D$16".

How should I change that line to return the value which is Cell D16 on my
UPDATES tab?


Brad E.

Getting the entry of a Named Range
 
Thanks, Roger. I like this better than the "RefersToRange" method. Evaluate
makes sense to me. Brad

"Roger Govier" wrote:
Hi Brad

try
evaluate(thisworkbook.names("VERSION").value)

--
Regards
Roger Govier

Brad E. wrote:
I have a Named Range called VERSION, in which I update every time I make a
new version of the workbook. In my macro, I want to grab this value.

ThisWorkbook.Names("VERSION").Value returns "=UPDATES!$D$16".

How should I change that line to return the value which is Cell D16 on my
UPDATES tab?

.



All times are GMT +1. The time now is 09:45 PM.

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