LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default Modifying a Defined Name's Contents

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Print Name's list and Names Range? Excel_Oz Excel Worksheet Functions 3 March 29th 07 02:03 AM
How to create table of cell names with the name's cell address WildwoodEngr Excel Discussion (Misc queries) 1 October 26th 06 02:52 PM
displaying contents of a user defined directory cyzax7 via OfficeKB.com Excel Programming 1 June 9th 06 08:47 AM
Selecting a defined Name via a cell's contents PCLIVE Excel Programming 9 July 14th 05 06:38 PM


All times are GMT +1. The time now is 03:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"