Selection is too large - when pasting formats programmatically

H

Hiran

Hi,

(Excel 2003)

After pasting a recordset with Range("F50").CopyFromRecordset rsData I
am trying to paste formats copied from a row above. iLastRow is the
last row of the data. Example:

iLastRow = 2000 'for testing. this is normally determined at
runtime

Sheets("Main").Range("F26:BB26").Copy

Sheets("Main").Range(Cells(50, 6), Cells(iLastRow, 54)).PasteSpecial
Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False,
Transpose:=False

This works fine up to about 2000 rows. After that I get error
"Selection is too large ". What's that about?

Has anyone any other ideas on formatting a data block pasted from a
recordset? Pre-formatting the cells is not an option as
CopyFromRecordset will wipe those out, and also the depth of the range
is only known at runtime.

Thanks for any help.
Hiran
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top