Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error Copying Range/Cell with long Text String
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error Copying Range/Cell with long Text String
rngPaste.Value = left(rngCopy.Value,256)
"MikeZz" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Error Messages: 'Text String is Too Long...'; 'Can't Record Macro' | Excel Programming | |||
Error: The text string you entered is too long. | Excel Worksheet Functions | |||
Error: The text string you entered is too long. | Excel Programming | |||
Error: The text string you entered is too long. | Excel Discussion (Misc queries) | |||
text in cell too long? run-time error | Excel Programming |