Nelson78
Well-known Member
- Joined
- Sep 11, 2017
- Messages
- 526
- Office Version
- 2007
Hello everybody.
I need to copy the sheet ("Alpha") from the closed workbook ("Beta") and paste it in thisworkbook sheet ("Alpha").
Unfortunately, with this code a new sheet is generated in thisworkbook ("Alpha(2)"), instead of pasting in the pre existing sheet Alpha.
Could anyone help me?
I need to copy the sheet ("Alpha") from the closed workbook ("Beta") and paste it in thisworkbook sheet ("Alpha").
Code:
Sub copy_alpha()
Application.ScreenUpdating = False
Set wb1 = thisworkbook
Set file2 = Workbooks.Open("S:\xxxx\yyyyyy\Beta.xls")
file2.Sheets("Alpha").Copy wb1.Sheets("Alpha")
file2.Close
Application.ScreenUpdating = True
End Sub
Unfortunately, with this code a new sheet is generated in thisworkbook ("Alpha(2)"), instead of pasting in the pre existing sheet Alpha.
Could anyone help me?
Last edited by a moderator: