ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to get evaluated value of worksheet names that do not refer to worksheet ranges? (https://www.excelbanter.com/excel-programming/421289-how-get-evaluated-value-worksheet-names-do-not-refer-worksheet-ranges.html)

Dick Watson

How to get evaluated value of worksheet names that do not refer to worksheet ranges?
 
I have workbook named "ranges" that refer to things that aren't ranges of
cells.

E.g., MinWidthToSet refers to "=8" and RowsToTest refers to
"=COUNTA(MyRange)" (and these are simplified examples for discussion).

The problem comes in when trying to get a value for these from VBA since
they can't be found as default values of Range("MinWidthToSet") or
Range("RowsToTest").

I tried using Names("MinWidthToSet") which returns the string "=8"--I can
strip the "=" and CLng the remainder. Ugly but functional.

Bet there's no good way to do anything with the string "=COUNTA(MyRange)".

I've also tried Application.Evaluate "=RowsToTest" but this gets into all
kinds of ugly issues of the context in which the evaluation is done since
these are all scoped to specific sheets and multiple workbooks may be open
when this needs to be evaluated.

Is there a workaround to get the evaluated value of these names that aren't
cell ranges?

How does one define the complete context for an Application.Evaluate when
running code that belongs to a specific worksheet?

Thanks in advance!


Dick Watson

How to get evaluated value of worksheet names that do not refer to worksheet ranges?
 
Brain Damage.

Me.Evaluate ("NamedWhatever")

"Dick Watson" wrote in
message ...
I've also tried Application.Evaluate "=RowsToTest" but this gets into all
kinds of ugly issues of the context in which the evaluation is done since
these are all scoped to specific sheets and multiple workbooks may be open
when this needs to be evaluated.

Is there a workaround to get the evaluated value of these names that
aren't cell ranges?




All times are GMT +1. The time now is 01:17 PM.

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