T
TR
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
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