I have the below code that list the name of the different ranges in the workbook into sheet("D_RANGES"). The user will then manually edit this list in sheet("LIST") as not all the ranges are needed. The idea is that user want only the a selected number of range to be copied and this selected range will varied depending on requirement. It is the step of copying the value of the name_ranges from sheet("D_RANGES") where the range_name matches the edited list of item in sheet("D_LIST") is where I am getting stock at. Please help!
Sub ExtractNames()
Dim cntr As Long
Dim wkbTarget As Workbook
Set wkbTarget = ActiveWorkbook
wkbTarget.Activate
Sheets("D_RANGES").Select
Range("R_NAMES").Select
Selection.ClearContents
cntr = 1
ActiveCell.Offset(0, 0) = "Name as defined"
ActiveCell.Offset(0, 1) = "Contents of the defined name"
Do While cntr <= wkbTarget.Names.Count
ActiveCell.Offset(cntr, 0) = wkbTarget.Names(cntr).Name
ActiveCell.Offset(cntr, 1) = "'" & wkbTarget.Names(cntr).RefersTo
cntr = cntr + 1
Loop
Columns.AutoFit
End Sub
Bookmarks