Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm trying to copy the contents of a named range on one worksheet over
to another named range on another worksheet, using Paste Special macro code. However, when I execute the macro, it seems to lose the definition of the target named range. 1. I defined the source named range "RisksTable" as $AI$31:$AR$36 on one worksheet, called "6-Blocker", using the spreadsheet menu functions. 2. I defined the target named range "RisksTableTarget as $A$33:$J38 on another worksheet, called "Project Risks", also using the spreadsheet menu functions. 3. My code looks like this: Sheets("6-Blocker").Select Range("RisksTable").Select Selection.Copy Sheets("Project Risks").Select Range("RisksTableTarget").Select Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False 4. When I execute the code, it fails with run-time error 1004, "Method 'Range' of object_Global failure". I went back to the range definitions and found that while RisksTable was intact, the range RisksTableTarget has been re-defined somehow as 'Project Risks'!REF#. 5. If instead of referencing the named range, "RisksTableTarget", I use a cell range, i.e., $A$33:$J$38, the code runs fine. But I need to reference the named range, because the user will be making changes to named range definitions only, and not have to diddle around with the code. Can somebody help with this problem? Thanks in advance. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Losing a named range | Excel Discussion (Misc queries) | |||
Exporting range definitions from one workbook to another | Excel Programming | |||
Sustaining Range Definitions in a Function | Excel Discussion (Misc queries) | |||
How can I change range name definitions as the No. of rows change. | Excel Programming | |||
Trouble with 2 range definitions ... | Excel Programming |