View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
KR KR is offline
external usenet poster
 
Posts: 24
Default past method error

This is my first go at vb programming with excel. I have code attached to a
pushbutton to copy a sheet in the current workbook, open an existing workbook
and pasting the copied info over the data in a sheet called "pricing". My
code is below. I am getting a run-time err '1004': Paste method of Worksheet
class failed.
It does paste the info but doesn't finish the routine.

Any help would be greatly appreciated.

Private Sub CommandButton1_Click()

Sheets("Sheet3").Select
Selection.Copy
Workbooks.Open Filename:="G:\PriceLists\PriceList2.xls"
Workbooks("Pricelist2.xls").Activate
Sheets("pricing").Activate
ActiveSheet.Unprotect Password:="xxxx"
ActiveSheet.Paste
ActiveSheet.Protect Password:="xxxx"
Sheets("Glossary").Select

End Sub


--
kr