View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default ActiveSheet.Paste error

You can't copy a range with more areas in one time

Try this with Dati.xls open but not active
The sheet where you want to copy from is the active sheet

Sub test()
With Workbooks("Dati.xls").Sheets("Standard")
.Unprotect Password:="xxx"
ActiveSheet.Range("D:F").Copy .Range("A1")
ActiveSheet.Range("I:L").Copy .Range("F1")
.Protect Password:="xxx"
End With
End Sub

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Pier" wrote in message ...
Hello,
i have an error 1004 on Activesheet.Paste, can you explain
me the reason? Thanks

Columns("D:F").Select
Range("D:F,I:L").Select
Range("I1").Activate
Selection.Copy
Windows("Dati.xls").Activate
ActiveSheet.Unprotect Password:="xxx"
Application.ScreenUpdating = False
Range("A1").Select
Sheets("Standard").Select
ActiveSheet.Unprotect Password:="xxx"
Sheets("Standard").Select
ActiveSheet.Paste <--------------------------
Range("G1").Select