Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm trying to create a macro that will modify the Refers to: field of a
defined name by doing the following: 1) Create a UDF called "SEARCHNAME" that searches the Refers to: field of a defined name and returns a matched value. For example, =SEARCHNAME(find_text As Range, within_text As Range) where find_text is a named range containing text values and within_text is the Refers to: field of a defined name. 2) Set value "a" = to the Refers to: field of the name "Test_Formula" which contains =SUM(1,2). 3) Using the function SEARCHNAME, iterate through the values in the name "Functions" and see if they occur in value "a" and set the value "b" as the found value. The name "Functions" refers to the range A1:A2 where A1 contains the text SUM and A2 contains the text PRODUCT. 4) Set value "c" = to the selected item in ComboBox1 that contains the text values SUM and PRODUCT. 5) Modify the Refers to: field in the name "Test_Formula" by replacing value "b" with "c" I'm not a developer, but I was thinking along the lines of the following: Sub Macro_Modify_Name a = ActiveWorkbook.Names("Test_Formula").RefersToRange b = SEARCHNAME("Functions","Test_Formula") c = selected value of ComboBox1 d = Application.Substitute(a,b,c) ActiveWorkbook.Names("Test_Formula").RefersToRange = d End Sub Any ideas ? - Ronald K. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to Print Name's list and Names Range? | Excel Worksheet Functions | |||
How to create table of cell names with the name's cell address | Excel Discussion (Misc queries) | |||
displaying contents of a user defined directory | Excel Programming | |||
Selecting a defined Name via a cell's contents | Excel Programming |