ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   worksheet.copy truncates at 255 characters (https://www.excelbanter.com/excel-programming/369786-worksheet-copy-truncates-255-characters.html)

Pelle

worksheet.copy truncates at 255 characters
 
Hi, I have tried to use
worksheet.copy after:= etc etc
to copy data from one worksheet to another but when cells contains more than
255 characters it will be truncated. Does anyone has a solution to this?

/Pelle

Ron de Bruin

worksheet.copy truncates at 255 characters
 
One way is to a add a new sheet and use
Cells.copy to copy all cells to the new sheet.

Dim ws As Worksheet
Dim ws2 As Worksheet

Set ws = ActiveSheet
Set ws2 = Worksheets.Add

ws.Cells.Copy ws2.Range("A1")


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Pelle" wrote in message ...
Hi, I have tried to use
worksheet.copy after:= etc etc
to copy data from one worksheet to another but when cells contains more than
255 characters it will be truncated. Does anyone has a solution to this?

/Pelle




Dave Peterson

worksheet.copy truncates at 255 characters
 
I'd use a combination of what you do and what Ron suggested.

dim wks as worksheet
dim newWks as worksheet

set wks = worksheets("somesheetname")

wks.copy 'to a new workbook?

set newwks = activesheet

'go back and get the values (including the long ones)

wks.cells.copy _
destination:=newwks.range("a1")

======
This way, I get all the page setup, filters, freeze panes, etc that are on the
original worksheet.

Pelle wrote:

Hi, I have tried to use
worksheet.copy after:= etc etc
to copy data from one worksheet to another but when cells contains more than
255 characters it will be truncated. Does anyone has a solution to this?

/Pelle


--

Dave Peterson

Ron de Bruin

worksheet.copy truncates at 255 characters
 
Hi Dave

Better this way
Excel 2007 not have this problem anymore

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Dave Peterson" wrote in message ...
I'd use a combination of what you do and what Ron suggested.

dim wks as worksheet
dim newWks as worksheet

set wks = worksheets("somesheetname")

wks.copy 'to a new workbook?

set newwks = activesheet

'go back and get the values (including the long ones)

wks.cells.copy _
destination:=newwks.range("a1")

======
This way, I get all the page setup, filters, freeze panes, etc that are on the
original worksheet.

Pelle wrote:

Hi, I have tried to use
worksheet.copy after:= etc etc
to copy data from one worksheet to another but when cells contains more than
255 characters it will be truncated. Does anyone has a solution to this?

/Pelle


--

Dave Peterson





All times are GMT +1. The time now is 07:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com