worksheet.copy truncates at 255 characters

G

Guest

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
 
R

Ron de Bruin

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")
 
D

Dave Peterson

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.
 

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