annir 0 Newbie Poster

hi everyone;

can somebody help me with my project. I have different files in one folder (Budget Folder) then I will import that in a single excel file (destibook.xls). This is the code.

Dim DestBook As Workbook, SrcBook As Workbook

Application.ScreenUpdating = False
Set SrcBook = Workbooks.Open("C:\Documents and Settings\cbanato\My Documents\Butget Folder\2008. Bellevue.xls")

On Error Resume Next
Set DestBook = Workbooks.Open("C:\Documents and Settings\cbanato\My Documents\folder\destibook.xls")
If Err.Number = 1004 Then
Set DestBook = Workbooks.Add
SrcBook.Worksheets(1).Range("B2:C2,E2:F2").Copy
DestBook.Worksheets(1).Range("A1").PasteSpecial
Application.CutCopyMode = False
DestBook.SaveAs ("C:\Documents and Settings\cbanato\My Documents\KPI folder\destibook.xls")
DestBook.Close
Else
SrcBook.Worksheets(1).Range("B2:C2,E2:F2").Copy
DestBook.Worksheets(1).Range("A1").PasteSpecial
Application.CutCopyMode = False
DestBook.Save
DestBook.Close
End If
On Error GoTo 0
Set DestBook = Nothing
Set SrcBook = Nothing

This code can import single file only... which is the 2008. Bellevue.xls. How can i access or get the other files inside the Budget Folder and paste it in the same file which is the destibook.xls...

in short there are 70 up files in the budget folder then I will import that in a single file only... I think I need to loop it, but how???

can someone help me pls..

thank you guys...:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.