Error Copying Range/Cell with long Text String

M

MikeZz

Hi
I have a macro that copies a row of data from one workbook to another if it
meets certain criteria.
rngCopy is the range being copied,
rngPaste is the range I where I copy it to.
Each range contains multiple cells.

I get error 1004 when part of the copy range has a cell with a lot of
text... it probably trigger's that error in Excel when you try to copy a cell
which is to many characters. I did notice that it copied all the preceding
cells in the copy range to the paste range and errored out on the first one
that was "to big".

Since I'm using the rngPaste.Value = rngCopy.Value, I don't want to check
the length of each cell before copying.

Is there a way to truncate any cells easily?

Thanks,
MikeZz

Here's the reader's digest of my code causing the error:

Set rngCopy = ManagerFileSht.Range("A" & testRow + r & ":N" & testRow + r)
pasteRow = firstPasteRowClosed + countCopyClosed
Set rngPaste = pasteClosed.Range("C" & pasteRow & ":p" & pasteRow)
rngPaste.Value = rngCopy.Value
 

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