View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Geoff Geoff is offline
external usenet poster
 
Posts: 371
Default I s there a quicker way to copy paste

Hi
Is there a quicker way to copy paste? In an xla the code below is executed
by a cmdbutton on a form and is used to copy Sheet1 to Sheet2. The copy
paste process takes 12 seconds for 21,000 rows by 10 columns. In its native
form (.xls) the same code and with the same data, the copy / paste takes 1
second. Records can exceed 40,000 rows sometimes and a faster way is
desirable.
Setting Calculation to manual does not appear to reduce the time below 12
seconds in xla form. Is there a better way?

T.I.A.

Geoff

Private Sub cmdExecute_Click()

With Application
.ScreenUpdating = False
.DisplayAlerts = False
End With

With Sheets(1)

'''get last original column
lastOrigCol = Split(.Range("IV1").End(xlToLeft).Address, "$")(1)

'''copy original data to sheet2
.Range("A:" & lastOrigCol).Copy Destination:=Sheets(2).Range("A1")

''''''other stuff

End With

With Application
.ScreenUpdating = True
.DisplayAlerts = True
End With
End Sub