Copy name range from a sheet to another sheet in the same workbook when it matches a criteria

smothkid

New Member
Joined
Jul 25, 2013
Messages
1
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
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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