Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
looping thru named ranges
Hi,
I have a bunch of pairs of named ranges, all of them consist of some leading identifier followed by LIVE or HARD, for instance spLIVE, spHARD; RussellLIVE, RussellHARD, etc. How would I loop through the range collection and copy/ paste values each LIVE range into respective HARD range? Thank you, -- ______ Regards, Greg |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
looping thru named ranges
One way:
Dim nmTest As Name Dim rDest As Range Dim rSource As Range Dim sTest As String For Each nmTest In ActiveWorkbook.Names sTest = nmTest.Name If sTest Like "*LIVE" Then sTest = Left(sTest, Len(sTest) - 4) & "HARD" On Error Resume Next Set rSource = nmTest.RefersToRange Set rDest = ActiveWorkbook.Names(sTest).RefersToRange On Error GoTo 0 If Not rDest Is Nothing And Not rSource Is Nothing Then _ rSource.Copy Destination:=rDest End If Next nmTest In article , Greg wrote: Hi, I have a bunch of pairs of named ranges, all of them consist of some leading identifier followed by LIVE or HARD, for instance spLIVE, spHARD; RussellLIVE, RussellHARD, etc. How would I loop through the range collection and copy/ paste values each LIVE range into respective HARD range? Thank you, |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Named ranges scope / workbook/worksheet level named ranges- changeswith variable use... | Excel Programming | |||
Copy data in named ranges to a newer version of the same template to identical ranges | Excel Programming | |||
Looping through named ranges | Excel Programming | |||
Deleting named ranges by looping through range collection | Excel Programming | |||
Looping through named ranges | Excel Programming |