get the named items in excel workbook

sush026

New Member
Joined
Jul 23, 2007
Messages
5
hi,

how can i get a list of the named items in a excel workbook (I am using excel 2007 Professional Plus). I need to search if a particular named item exists in the workbook and then i have to set the particular cell with "that" named item with a value. Please tell me how can i do this using C#

Thanks,
Sush
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
I'll give you it with VBA, you do the translation

Code:
    On Error Resume Next
    Set rng = Range("myName")
    On Error Goto 0
    If Not rng Is Nothing Then
        rng.Value = "myValue"
    End If
 
Upvote 0
I don't know about C~, but here is a VBA example:

Code:
Sub Test()
    Dim sName As String
    Dim nName As Name
    sName = "TheName"
    On Error Resume Next
    Set nName = ActiveWorkbook.Names(sName)
    If Err = 0 Then
        Evaluate(nName.RefersTo).Parent.Range(sName).Value = 123
    Else
        Err.Clear
    End If
    On Error GoTo 0
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,922
Messages
6,122,281
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top