TryingBest
New Member
- Joined
- Aug 2, 2022
- Messages
- 30
- Office Version
- 2016
- Platform
- Windows
Hi,
This code gives me an error. Unable to get why .. as where I see the same code for copying a sheet from closed workbook to active (This) workbook.
Please help!
This code gives me an error. Unable to get why .. as where I see the same code for copying a sheet from closed workbook to active (This) workbook.
Please help!
VBA Code:
Sub copyFirstWS()
Dim wb As Workbook
Set wb = Workbooks.Open("C:\Users\-")
With ThisWorkbook
wb.Worksheets(1).Copy Before:=.Worksheets(.Worksheets.Count)
End With
wb.Close savechanges:=False
End Sub