View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
TR[_2_] TR[_2_] is offline
external usenet poster
 
Posts: 9
Default Opening and pasting in active workbook

I am having trouble pasting the data from an opened .xls file into the
current sheet I am on.
I have opened the workbook I need, and then I am attempting to paste
the data into the workbook I am currently using. I have no trouble
pasting the data into a different sheet on the workbook, just not the
worksheet titled 'targetrenewal'.

Does anyone know what I am doing wrong?

Thanks!

Sub PW_Open()
Dim Wb1 As Workbook
Dim Wb2 As Workbook
Dim Wk1 As Worksheet
Application.ScreenUpdating = False
Set Wb1 = ActiveWorkbook
Set Wk1 = ActiveSheet
Wk1.Name = "TargetRenewal"
Set Wb2 = Workbooks.Open("C:\target rent\pw_targetrent.xls")
Wb2.Sheets("Sheet1").Copy _
Destination:=Wb1.Worksheets("TargetRenewal") ****this gives an
error 'Application-defined or Object-defined Error'*****
Wb2.Close False
Application.ScreenUpdating = True
End Sub