Below is the 1st step of my code. It list the name of the different ranges in the workbook into sheet("D_RANGES"). The user will then manually edit this list in sheet2 as not all the ranges are needed. Basically, this list will change every time.
The 2nd step of copying the value of the name_ranges from sheet(1) where the range_name matches the edited list of item in sheet("D_Ranges) 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
The 2nd step of copying the value of the name_ranges from sheet(1) where the range_name matches the edited list of item in sheet("D_Ranges) 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