I'm trying to get the information from multiple workbook that follow the same template but with different information on each one into one master workbook but I'm having trouble as the multiple workbook will constantly be changing as more support calls are made, I tried to write the code below but it will only work the workbook as it is not when it's updated in the future. I have attached the sample files hoping someone can help me out with this. Thank you in advance
SAMPLE WORKBOOK DOWNLOAD: https://we.tl/t-YwQhj3pBWw
Code:
[COLOR=#000000][FONT="]Sub LoopThroughDirectory()[/FONT][/COLOR]
[COLOR=#000000][FONT="]Dim MyFile As String[/FONT][/COLOR]
[COLOR=#000000][FONT="]Dim erow[/FONT][/COLOR]
[COLOR=#000000][FONT="]Dim Filepath As String[/FONT][/COLOR]
[COLOR=#000000][FONT="]Filepath = "C:\Desktop\CRM\"[/FONT][/COLOR]
[COLOR=#000000][FONT="]MyFile = Dir(Filepath)[/FONT][/COLOR]
[COLOR=#000000][FONT="]Do While Len(MyFile) > 0[/FONT][/COLOR]
[COLOR=#000000][FONT="] If MyFile = "Draft template for CRM.xls*" Then[/FONT][/COLOR]
[COLOR=#000000][FONT="] Exit Sub[/FONT][/COLOR]
[COLOR=#000000][FONT="] End If[/FONT][/COLOR]
[COLOR=#000000][FONT="] [/FONT][/COLOR]
[COLOR=#000000][FONT="] Workbooks.Open (Filepath & MyFile)[/FONT][/COLOR]
[COLOR=#000000][FONT="] Range("*:*").Copy[/FONT][/COLOR]
[COLOR=#000000][FONT="] ActiveWorkbook.Close[/FONT][/COLOR]
[COLOR=#000000][FONT="] [/FONT][/COLOR]
[COLOR=#000000][FONT="] erow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row[/FONT][/COLOR]
[COLOR=#000000][FONT="] ActiveSheet.Paste Destination:=Worksheets("Sheet1").Range(Cells(erow, 1), Cells(erow, 4))[/FONT][/COLOR]
[COLOR=#000000][FONT="] [/FONT][/COLOR]
[COLOR=#000000][FONT="] MyFile = Dir[/FONT][/COLOR]
[COLOR=#000000][FONT="]Loop[/FONT][/COLOR]
[COLOR=#000000][FONT="]End Sub[/FONT][/COLOR]
SAMPLE WORKBOOK DOWNLOAD: https://we.tl/t-YwQhj3pBWw