Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub LoopThroughDirectory()
- Dim MyFile As String
- Dim Filepath As String
- Dim count as Integer
- Filepath = "D:DATA"
- MyFile = Dir(Filepath)
- count = 1
- Application.ScreenUpdating = False
- While MyFile <> ""
- If MyFile = "master.xlsm" Then Exit Sub
- Workbooks.Open (Filepath & MyFile)
- Workbooks(MyFile).sheets("Sheet1").Range("F1:F100").Copy thisworkbook.sheets("Sheet1").Cells(3, count)
- Workbooks(MyFile).Close
- count = count + 1
- MyFile = Dir
- Loop
- Application.ScreenUpdating = True
- End Sub
Add Comment
Please, Sign In to add comment