ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing a named range within a formula (https://www.excelbanter.com/excel-programming/424336-changing-named-range-within-formula.html)

Mark B.

Changing a named range within a formula
 
I'm trying to set up a macro that will update the reference to a anamed range
within a formula.

For example, cell A1 contains a value of "LastName" which also happens to be
a named range.

Cell B1 contains the formula "=Count(LastName)"

When I change the value of A1 to the name of another named range, i.e.
"Address", and run the code, I want the formula in B1 to change to
"=Count(Address)"

Ideas?
--
Thanks,
Mark

Chip Pearson

Changing a named range within a formula
 

Create a name called, for example, CountRange and assign it to
=COUNT(INDIRECT($A$1))

Then call it from a cell with

=CountRange

It will return the COUNT of the range whose name appears in cell A1.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Wed, 18 Feb 2009 13:19:02 -0800, Mark b.
wrote:

I'm trying to set up a macro that will update the reference to a anamed range
within a formula.

For example, cell A1 contains a value of "LastName" which also happens to be
a named range.

Cell B1 contains the formula "=Count(LastName)"

When I change the value of A1 to the name of another named range, i.e.
"Address", and run the code, I want the formula in B1 to change to
"=Count(Address)"

Ideas?



All times are GMT +1. The time now is 02:14 PM.

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