Problem with Macro Code

  • Thread starter Thread starter John
  • Start date Start date
J

John

I have the following selected piece of Code that hits debug on line
"ActiveSheet.Paste". The reason it does is that a command window comes up
saying
"Do you want to Replace the Contents of the Destination Cells" - how can I
automate this to say "Yes" within my code?

Sheets("Claim Form").Select

ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ActiveSheet.Unprotect Password:="123"
Range("A1").Select
Cells.Select
Selection.Copy
Sheets("E-Claim").Visible = True
Sheets("E-Claim").Select
ActiveSheet.Unprotect Password:="123"
Range("A1").Select
ActiveSheet.Paste


Thanks
 
add a line:
Application.Displayalerts = False
before the paste
Bob Umlas
Excel MVP
 
Thanks Guys, I've made the two adjustments, but message debugs now with
"Paste Method of Worksheet Class failed" again at the line

ActiveSheet.Paste
 
Back
Top