
Originally Posted by
xlbiznes
try using the like function :
If wb.Name Like "*Changes*" Then
MsgBox wb.Name
End If
Apply the same logic for the worksheet.
Hello xlbiznes thanks for the reply!
This is what I have so for, but I am getting a 'Next without For' error now.
Sub CopierTest()
Dim wb As Workbook, x As String
Application.DisplayAlerts = False
For Each wb In Workbooks
If wb.Name <> ThisWorkbook.Name And _
wb.Name Like "*Changes*" Then
x = wb.Name
Next wb
Workbooks(x).Activate
Worksheets("Sheet1").Activate
Columns("A:H").Select
Selection.Copy
ThisWorkbook.Worksheets("PasteHere").Activate
Range("A1").Select
ActiveSheet.Paste
Range("A1").Select
Workbooks(x).Close savechanges:=False
Application.DisplayAlerts = True
End Sub
Bookmarks