Dear Reader,
I need help with this Macro:
Dim strF As String, strP As String
Dim wb As Workbook
Dim ws As Worksheet
strP = "C:\Users\USER\Desktop\test" 'change for the path of your folder
strF = Dir(strP & "\*.xls") 'Change as required
Do While strF <> vbNullString
Set wb = Workbooks.Open(strP & "" & strF)
Set ws = wb.Sheets(1) 'I define ws to take the first sheet from each workbook
ws.Range("B6:P6").Copy Workbooks("Book1").Sheets(1).Range("B18") 'Book1 where they should be pasted.
wb.Close True
strF = Dir()
Loop
The need of this macro is to copy a line (B6:P6) from 90 excel workbooks (Files) and paste it into a new Workbook in the first sheet.
My problem is that I cant make it paste the lines in row (down to each other), for example first line should be pasted in B18 the next one in B19 and so on ...
Can you help me please ?
I need help with this Macro:
Dim strF As String, strP As String
Dim wb As Workbook
Dim ws As Worksheet
strP = "C:\Users\USER\Desktop\test" 'change for the path of your folder
strF = Dir(strP & "\*.xls") 'Change as required
Do While strF <> vbNullString
Set wb = Workbooks.Open(strP & "" & strF)
Set ws = wb.Sheets(1) 'I define ws to take the first sheet from each workbook
ws.Range("B6:P6").Copy Workbooks("Book1").Sheets(1).Range("B18") 'Book1 where they should be pasted.
wb.Close True
strF = Dir()
Loop
The need of this macro is to copy a line (B6:P6) from 90 excel workbooks (Files) and paste it into a new Workbook in the first sheet.
My problem is that I cant make it paste the lines in row (down to each other), for example first line should be pasted in B18 the next one in B19 and so on ...
Can you help me please ?