I have about 50 xlsx files in a folder that have three tabs: 1. Active, 2. Active Change, and 3. Suspended. I want to combine all the tabs with names similar to “Suspended” into one workbook. I keep getting syntax errors in the 7th line of code, “For Sheets…“. Any help rectifying this would be greatly appreciated!
Sub GetSheets() Path = "C:UsersTracy Anderson DellDropboxMemberships & Subs TrackingMBOMembership59th Street" Filename = Dir(Path & ".xlsx") strSheetName = "Suspended" Do While Filename <> "" Workbooks.Open Filename:=Path & Filename, ReadOnly:=True For Sheets(strSheetName).Select In ActiveWorkbook.Sheets Sheet.Copy After:=ThisWorkbook.Sheets(1) Next Sheet Workbooks(Filename).Close Filename = Dir() Loop End Sub