Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default PasteSpecial error message

Hi Guys
I'm totally puzzled. Every second time I run this code I get the following
message:
"PasteSpecial method of Range class failed"
However, if I remove ActiveSheet.Protect Password:="dorPseO"
I don't get any error messages
Obviously I'm doing something wrong - Any suggestions?

Public Sub OesOorProdSt()
'Prosedure om pak produktiwiteit oor te dra na kontrole blad
Dim OesStatPro As Range
Range("OesRek!OesStatPro").Copy
Sheets("OesProd").Select
ActiveSheet.Unprotect Password:="dorPseO"
Range("A1").Select
Range("A1").End(xlDown).Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveSheet.Protect Password:="dorPseO"

End Sub

--
HJN
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default PasteSpecial error message

IF?? the destination cell is not protected why not just copy paste withOUT
selections. If it IS protected just unprotect/protect sheet from here by UN
commenting. Notice the dots in the WITH statement

untested but try
Public Sub OesOorProdSt()
with Sheets("OesProd")
' .Unprotect Password:="dorPseO
Range("OesRek!OesStatPro").Copy .cells(1,1).end(xldown).offset(1)
' .Protect Password:="dorPseO"
end with
end sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Hennie Neuhoff" wrote in message
...
Hi Guys
I'm totally puzzled. Every second time I run this code I get the following
message:
"PasteSpecial method of Range class failed"
However, if I remove ActiveSheet.Protect Password:="dorPseO"
I don't get any error messages
Obviously I'm doing something wrong - Any suggestions?

Public Sub OesOorProdSt()
'Prosedure om pak produktiwiteit oor te dra na kontrole blad
Dim OesStatPro As Range
Range("OesRek!OesStatPro").Copy
Sheets("OesProd").Select
ActiveSheet.Unprotect Password:="dorPseO"
Range("A1").Select
Range("A1").End(xlDown).Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks
_
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveSheet.Protect Password:="dorPseO"

End Sub

--
HJN


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error on pastespecial -goss Excel Programming 2 October 2nd 08 06:44 PM
PasteSpecial Method Error PW11111 Excel Discussion (Misc queries) 1 December 19th 06 01:24 PM
Error in PasteSpecial ? Corey Excel Programming 14 October 30th 06 06:10 AM
PasteSpecial error Robert Christie[_3_] Excel Programming 4 December 27th 04 10:37 PM
PasteSpecial Error sowetoddid[_14_] Excel Programming 3 April 28th 04 12:14 AM


All times are GMT +1. The time now is 07:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"