View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Hiran Hiran is offline
external usenet poster
 
Posts: 10
Default Selection is too large - when pasting formats programmatically

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