Hi All,
I have around 10-15 excel files in a folder which are refreshed each week. I need to loop through these files and copy the data form them into one master sheet.
I plan to create the macro in a mast file called Pipeline Consolidated and run it form this workbook so don’t want this file to open.
I have the code once the additional workbook is open to select the cells and then copy them back to my master sheet, my problem is how to loop through all the excel file in the directory.
So far I have to put the file name in and repeart this step each time.
Path = “S:ReportingPipelineSubmitted by departmentsPipeline template imp.XLSX”
Workbooks.Open Filename:=Path
””’End of Open Workbook
‘’’’’’’’’’’’’’’copies form the additioanal workbook’’’’’’’’’’’’’’’’’’
Sheets(“Pipeline”).Select
If ActiveSheet.AutoFilterMode = True Then
ActiveSheet.AutoFilterMode = False
End If
LastRow = ActiveSheet.Cells(Rows.Count, “B”).End(xlUp).Row
Range(“A4:J” & LastRow).Select
Selection.Copy
Windows(“Pipeline Consolidated.xlsm”).Activate
”’selects the sheet name on the Consolildated workbook and copies the data
Sheets(“Pipeline Consolidated”).Select
Range(“A4”).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
I have been searching google for ages but as i am new to VBA and have learnt from you guys and myself it is very difficult as there are alot of complex answers when i was hoping it would be quite simple.
REgards,