PDA

View Full Version : Solved: Copy Large Cells



GMan
02-03-2007, 04:39 PM
I am copying a cell from one workbook to another. However, when the cells text gets to large (greater than 250 characters it seems, I currently have a cell with 999 that I am working with this issue.) the line creates and error. Is there a better way to complete this tasks or some way to get around the limit?

The line of code that I am using is:
Workbooks(1).Worksheets(1).Cells(1,5) = Workbooks(2).Worksheets(1).Cells(1,5)

Not sure if this will help at all... But the error information that I am receiving is below:
Err.Number = 1004
Err.Source = VBAProject
Err.Description = Application-defined or object-defined error

Thanks,
Gregor

GMan
02-03-2007, 06:14 PM
Ok... I managed to fix my own problem. However, I would like to know the difference and why one works and the other doesn't.

The Code that worked is:
Workbooks(2).Worksheets(1).Cells(1,5).Copy
Workbooks(1).Worksheets(1).Cells((1,5).PasteSpecial(xlPasteAll)

Any explination will be greatly appreciated.

Thanks!

Ken Puls
02-04-2007, 12:00 PM
I don't know that I have an explanation for you on this, but something of a similar nature...

Prior to Excel 2007, when you linked a cell to one in another workbook, it would only pull back the first 255 characters of that cell, unless the source workbook was opened.

In this case, though, it would seem that the other workbook is opened, but I'd bet that it is related somehow. Have you tried pasting with xlPasteValues, instead of xlPasteAll?