ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ActiveSheet.Paste error (https://www.excelbanter.com/excel-programming/272652-re-activesheet-paste-error.html)

Ron de Bruin

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





All times are GMT +1. The time now is 03:59 PM.

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