View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Copy and paste Named Ranges

For sheet level names with sheets in the same workbook (Source and Target):

Public Sub CopyName()
Dim srcNme As Name
For Each srcNme In Sheets("Source").Names
Set rng = Sheets("target").Range( _
srcNme.RefersToRange.Address)
rng.Name = Replace(srcNme.Name, "Source", "Target")
Next srcNme
End Sub


--
Regards,
Tom Ogilvy


"Robert H" wrote in message
oups.com...
Experimenting I have set up a workbook with two sheets "Source" with
some local named ranges and "Target" (blank) to try and copy ranges
to. So far I have:

Public Sub CopyName()
Dim srcNme As Name

For Each srcNme In Sheets("Source").Names

Range(srcNme).Copy Destination:= _
Sheets("target").Range(Range(srcNme).Address)
'FIX - only pastes values

Next srcNme
End Sub

I have played around with a few different options but I can still only
get the values to show up on the target sheet. Im getting close to
the pulling my hair out point.....