lickrob
05-22-2013, 07:13 AM
Hi,
So to start with, some background.
my macro opens up 6 different workbooks and moves the contents over onto one main sheet. pretty simple...
the code that moves the contents over is:
ThisWorkbook.Worksheets("DC Master Sheets").Range("A" & mainend, "O" & endrow + 1).Formula = wb.Worksheets(1).Range("A2", "O" & endrow + 1).Formula
note that the variables mainend and endrow are correct.
so i have been testing it and it all works fine then i hit one workbook and i got the error
"Application-defined or object-defined error"
Debugging!!
So i tried just moving the first row... worked fine
ThisWorkbook.Worksheets("DC Master Sheets").Range("A3", "O3").Formula = wb.Worksheets(1).Range("A2", "O2").Formula
Tried first 100 rows... Fine
ThisWorkbook.Worksheets("DC Master Sheets").Range("A3", "O100").Formula = wb.Worksheets(1).Range("A2", "O100").Formula
First 200... Fine
First 300... Error!
So I worked back and narrowed it down further and got to the single cell that was causing the error. (N250 for those that care). I looked at the cell and it had 1095 characters in it.
so my question is, why can i not move cell contents that have lots of characters in them?
also how do i fix this. I'm looking for more of a fix than a workaround as i already have several workarounds i could use.
Edit: range().value will not work either.
So to start with, some background.
my macro opens up 6 different workbooks and moves the contents over onto one main sheet. pretty simple...
the code that moves the contents over is:
ThisWorkbook.Worksheets("DC Master Sheets").Range("A" & mainend, "O" & endrow + 1).Formula = wb.Worksheets(1).Range("A2", "O" & endrow + 1).Formula
note that the variables mainend and endrow are correct.
so i have been testing it and it all works fine then i hit one workbook and i got the error
"Application-defined or object-defined error"
Debugging!!
So i tried just moving the first row... worked fine
ThisWorkbook.Worksheets("DC Master Sheets").Range("A3", "O3").Formula = wb.Worksheets(1).Range("A2", "O2").Formula
Tried first 100 rows... Fine
ThisWorkbook.Worksheets("DC Master Sheets").Range("A3", "O100").Formula = wb.Worksheets(1).Range("A2", "O100").Formula
First 200... Fine
First 300... Error!
So I worked back and narrowed it down further and got to the single cell that was causing the error. (N250 for those that care). I looked at the cell and it had 1095 characters in it.
so my question is, why can i not move cell contents that have lots of characters in them?
also how do i fix this. I'm looking for more of a fix than a workaround as i already have several workarounds i could use.
Edit: range().value will not work either.