I have this code which a report is generated and it is not a constant name except the beginning of the file name which is "_ttv-".
Its not pulling the data like I need it to. The workbooks name always changes after I generate it - after it copies that data over, I would like the "_ttv-" workbook to close. Any help would be greatly appreciated! Thank you in advance!![]()
Sub wbName() Dim wb As Workbook Const wbName As String = "_ttv-" ThisWorkbook.Sheets("IEX Data - CT Set 20").Cells.ClearContents For Each wb In Application.Workbooks If wb.Name Like wbName & "*" Then With wb.Sheets("Intraday") Sheets("Intraday").Cells.Copy With Worksheets("IEX Data - CT Set 20") .Paste Destination:=.Range("A1") End With Application.CutCopyMode = False Application.DisplayAlerts = False Sheets("Intraday").Delete Application.DisplayAlerts = True 'New line End With End If Next wb End Sub
Bookmarks