I have written code to open a file and copy the data from sheet1 and paste in on sheet "Imported Data"
I need the code amended so that I do not need to delete sheets2
Your assistance is most appreciated
I need the code amended so that I do not need to delete sheets2
Your assistance is most appreciated
Code:
Sub Open_Workbook()
ChDir ("C:\downloads")
Sheets(2).Delete
Dim nb As Workbook, tw As Workbook, ts As Worksheet, TheFile As String, ThePath As String
ThePath = "C:\extract\"
TheFile = Dir(ThePath & "PTAW*Sales" & "*.csv")
'If TheFile = False Or IsEmpty(TheFile) Then Exit Sub
With Application
.ScreenUpdating = False
End With
Set tw = ThisWorkbook
Set ts = tw.ActiveSheet
Set nb = Workbooks.Open(TheFile)
nb.Sheets(1).Copy After:=Workbooks("PTAW BR1 Sales.xlsm").Sheets(1)
Sheets(2).Name = "Imported Data"
ChDir ("C:\my Documents")
End Sub