I am currently novice when it comes to VBA and I have this problem that requires an expert in this field. So I have a Masterfile Named Archive with Extract button and I have multiple excel workbook (20+) in a folder. I wanted to copy a specific information from those workbook and paste it to my masterfile contionusly to the next blank cell.
Not sure what is not working, Hoping someone could actually assist me on this. =(
Not sure what is not working, Hoping someone could actually assist me on this. =(
VBA Code:
Sub loopthru()
Dim MyFile As String
Dim erow
Dim rw As Range
MyFile = Dir("C:\Users\ChrisLacs\Desktop\My Files\")
Do While Len(MyFile) > 0
If MyFile = "Archive.xlsm" Then
Exit Sub
End If
If rw.Columns("J").Value = "Apple" Then
Workbooks.Open (MyFile)
Range("B9:N9").Copy
ActiveWorkbook.Close
erow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
ActiveSheet.Paste Destination:=Worksheets("Sheet1").Range(Cells(erow, 1), Cells(erow, 13))
MyFile = Dir
Loop