Excel 2007 Paste Formats error "selection too large"

blackshh

New Member
Joined
Jul 8, 2008
Messages
21
I have a macro that copies one line (a named range) and pastes the format from this line to 1000 lines (also a neamed range). It worked no problem in Excel 2000 and 2003, but is giving a "run time error 1004 " "PasteSpecial Method of Range class failed". When I do this same process manually, I get the error "Selection too large". Does anyone know how to make this work in Excel 2007?
thanks

Here is the code...
.Range("rng_FormatCopy1").Copy
.Range("rng_FormatPaste1").PasteSpecial xlFormats
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Can you show a few more lines of code above and below the ones you posted? How many columns wide are the named ranges?
 
Upvote 0
.Range("rng_Report").Copy
Application.DisplayAlerts = False
.Range("rng_Input_Report").PasteSpecial xlValues
.Range("rng_FormulaBudget").Copy
.Range("rng_FormulaPasteBudget").PasteSpecial xlFormulas
.Range("rng_FormulaVariance").Copy
.Range("rng_FormulaPasteVariance").PasteSpecial xlFormulas

.Range("rng_FormatCopy1").Copy
.Range("rng_FormatPaste1").PasteSpecial xlFormats
.Range("rng_FormatDesc").Copy
.Range("rng_FormatPasteDesc").PasteSpecial xlFormats
.Range("rng_FormatCopy2").Copy
.Range("rng_FormatPaste2").PasteSpecial xlFormats


Application.CutCopyMode = False
End With
**************
There is no problem with the copy and pastespecial xlValues or xlFormulas, only the xlFormats.

the named range for the copy is
D$14:H$14
The paste range is
D$28:H$1026
 
Upvote 0
.Range("rng_FormatDesc").Copy
.Range("rng_FormatPasteDesc").PasteSpecial xlFormats

This part works fine.
The copy range is $I$14
the paste range is $I$28:$J$1026
 
Upvote 0
I don't understand why you are having this problem. I ran the test code below in Excel 2007 w/o any issues:
Code:
Sub test15()
With ActiveSheet
    .Range("rng_A").Copy
    .Range("rng_B").PasteSpecial xlFormats
End With
End Sub
Where rng_A is $D$14:$H$14 and rng_B is $D$28:$H$1026.
Did you check to see if your named ranges have any errors in the Refers To: column of Name Manager? Are the names sheet-level or workbook-level names?
 
Last edited:
Upvote 0
Go to the Formulas menu and select Name Manager in the Defined Names section. Find the names and see what's listed in the Scope column for each name.
 
Upvote 0
Did you check to see if the specific named ranges in question have errors?
To do this: Go to the Formulas menu and select Name Manager in the Defined Names section. Find the names and see what's listed in the "Refers To" column (just to the left of the Scope column) for each name.
 
Upvote 0

Forum statistics

Threads
1,215,737
Messages
6,126,562
Members
449,318
Latest member
Son Raphon

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