PDA

View Full Version : Not really sure how to title this...



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.

patel
05-22-2013, 07:22 AM
attach please a sample file

lickrob
05-22-2013, 07:27 AM
I can't really attach a sample file as it contains very sensitive information on hundreds of large UK companies. the explanation above describes in detail the problem, attaching a file will not really help that much anyway.

patel
05-22-2013, 07:33 AM
sample file is not current file, but file with dummy data for testing.
You are asking for help, but you don't want help me

lickrob
05-22-2013, 07:59 AM
Ok i have attached a file, the problem is, i have had to remove lots of information from the sample file. as such the sample file will now work as it is missing the cell (N250) which was causing the error.

patel
05-22-2013, 10:25 AM
No code found in your attached file

SamT
05-22-2013, 02:18 PM
wb.Worksheets(1).Range("A2", "O100").Copy Destination:=ThisWorkbook.Worksheets("DC Master Sheets").Range("A3", "O100")

lickrob
05-23-2013, 05:44 AM
you know what i just assumed that wouldn't work. i was overlooking the obvious again.

tried it and it does seem to work! ill do some more testing and confirm...