Hello, can anyone please provide guidance on how to edit the following code to *delete* the worksheets beginning with "Labor BOE" from my initial/primary excel worksheet, after these sheets are copied into a new workbook?
Here is the code being utilized:
Here is the code being utilized:
Code:
Sub Export_X()
Dim Sh As Worksheet, wb As Workbook, txt As String
Set wb = Workbooks.Add
On Error Resume Next
For Each Sh In ThisWorkbook.Sheets
If Left(Sh.Name, 9) = "Labor BOE" Then
Sh.Copy After:=wb.Sheets(wb.Sheets.Count)
End If
Next Sh
On Error GoTo 0
txt = InputBox("Enter the Version Number or Date", "Export")
wb.SaveAs ThisWorkbook.Sheets("Home").Range("$F$9").Value & "_" & txt & ".xlsx"
MsgBox "BOE generation is complete."
End Sub