How can I consolidate data from n no. of workbooks (with similar format) into one worksheet? There can be any no of workbook present at any given point of time and the macro should be able to count the number of files available in the folder and run loop accordingly.
I was trying the following logic but it didnt work.
Sub collate()
Dim wb As Workbook
Dim sht As Object
Dim i As Integer
Dim str As String
Application.ScreenUpdating = False
str = Dir("D:\Feedback\" & "*.xls")
Set wb = Workbooks(str)
i = 1
Do While Len(str) > 4
Loop
ThisWorkbook.Sheets("Day1").Range("A2").Value = wb.Sheets("Day1feedback").Range("j2").Value
i = i + 1
End
End Sub
Bookmarks