Question

I have a folder containing same type of workbooks having single sheet i.e an invoice sheet. I want a vba code so that i could make a summary report in a new workbook that will copy bill number, customers name, amount etc from each workbook and at the and it will also calculate the total amount.. I hope you have understood what i mean to say. Is there any brilliant mind?

Was it helpful?

Solution

Use this.

 Sub GetSheets()
    Path = "C:\Users\dt\Desktop\dt kte\"
    Filename = Dir(Path & "*.xls")
    Do While Filename <> ""
    Workbooks.Open Filename:=Path & Filename, ReadOnly:=True
    For Each Sheet In ActiveWorkbook.Sheets
    Sheet.Copy After:=ThisWorkbook.Sheets(1)
    Next Sheet
    Workbooks(Filename).Close
    Filename = Dir()
    Loop
    End Sub
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top