View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter Grebenik[_2_] Peter Grebenik[_2_] is offline
external usenet poster
 
Posts: 9
Default Copy Cells with More than 255 Characters

Tim

Here is some code which seems to work for me. I would switch excel
into manual calculation before running the code.

Peter

Sub CopySelectedSheets()
Dim NoSh As Integer, SheetNames() As String, PNoSh As Integer, Nc As Integer
Dim SrcB As Workbook, DesB As Workbook

With ActiveWindow.SelectedSheets
ReDim SheetNames(1 To .Count)
For Nc = 1 To .Count
SheetNames(Nc) = .Item(Nc).Name
Next
End With

NoSh = Nc - 1
PNoSh = Application.SheetsInNewWorkbook

Application.SheetsInNewWorkbook = NoSh
Set SrcB = ActiveWorkbook
Set DesB = Workbooks.Add
For Nc = 1 To NoSh
SrcB.Sheets(SheetNames(Nc)).Cells.Copy _
Destination:=DesB.Sheets(Nc).Cells
DesB.Sheets(Nc).Name = SheetNames(Nc)
Next

Application.SheetsInNewWorkbook = PNoSh

End Sub