VBA/makro; import all files within a directory in excel

Fientje

New Member
Joined
Feb 1, 2014
Messages
4
I am new to this forum. I hope someone can help me:
I want to write a VBA or makro to establish the following:
I've got a directory 'xxx' with a number of files in it
I want to import those in excel (I chose within other for .xml, but than have to change it to all files) the columns are separated by :
In the next row beneath the imported file n, the file n+1 should be imported, repeated till all the files within directory 'xxx' have been imported in the excel file in column A.

Thanks in advance for your help!
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
from my library I am sending this macro. study each statement and you may have to modify to suit you.



Code:
Sub project()
'this macro is taken from various pages of web and modified to suit the project
 
   Application.ScreenUpdating = False
   Application.AskToUpdateLinks = False
   Application.DisplayAlerts = False
   Application.Calculation = xlCalculationManual
 
'   Dim path As Variant
    Dim excelfile As Variant
    With ThisWorkbook.Worksheets("Peer Review File Upload")
    path = .Range("B6")
    End With
     ChDir path
    excelfile = Dir("*.xlsx")
    Do While excelfile <> ""
        Workbooks.Open Filename:=path & excelfile
          source_name = Left(excelfile, Len(excelfile) - 5)
      'Debug.Print source_name
Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    Application.AskToUpdateLinks = True
    'Application.Calculation = xlCalculationAutomatic
     MsgBox "projet over"
End sub
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top