Hello, the code below imports all the excel files in the folder it is saved in. I use this to create a database containing those files. Is it possible to modify this code to only import the files that is has not previously imported?
Thanks!
Sub List()
Dim z As Long, e As Long, g As Long
Dim f As String, h As String
Cells(1, 1) = "=cell(""filename"")"
Cells(1, 2) = "=left(A1,find(""["",A1)-1)"
e = 2
Cells(3, 1).Select
f = Dir(Cells(1, 2) & "*.xls")
Do While Len(f) > 0
ActiveCell.Formula = f
ActiveCell.Offset(1, 0).Select
f = Dir()
Loop
z = Cells(Rows.Count, 1).End(xlUp).Row
For e = 3 To z
For g = 1 To 17
h = Choose(g, "H6", "A9", "F9", "A12", "F12", "A16", "F14", "A23", "A26", "C28", "D30", "D32", "D34", "A37", "D39", "F36", "F28")
Cells(2, g + 1) = h
Cells(1, 3) = "='" & Cells(1, 2) & "[" & Cells(e, 1) & "]Sheet1'!" & h
Cells(e, g + 1) = Cells(1, 3)
Next g
Next e
Call formatall
Call DeleteRows
MsgBox "PIR import is complete!"
End Sub
Bookmarks