Hi Everyone,
I have this following problem.
I use a macro to open files from a certain folder.
I would like to do the same with several .csv files.
The macro does what it does: it searches a folder for files, opens the files, consolidates them in one sheet. No problem.
However, my output is really strange.
When i open one of these .csv files manually, everything is correctly divided into the right columns (somehow the semicolon seperator is automatically picked up when i open the file). But when i run the macro it doesn't do the same. So it seems there is a difference in opening the .csv file normal and opening it via the macro.
It's kinda hard to explain, but because i'm working with some privacy sensitive information, i cannot simply add a .csv file in to this topic.
I can add the code that i use, maybe someone sees something strange.
Dim bookList As Workbook
Dim mergeObj As Object, dirObj As Object, filesObj As Object, everyObj As Object
Application.ScreenUpdating = False
Set mergeObj = CreateObject("Scripting.FileSystemObject")
'change folder path of excel files here
Set dirObj = mergeObj.Getfolder("\\c:\test")
Set filesObj = dirObj.Files
If filesObj.Count = 0 Then
MsgBox "No files in folder!"
Exit Sub
End If
For Each everyObj In filesObj
Set bookList = Workbooks.Open(everyObj)
Range("A2:IV" & Range("A65536").End(xlUp).Row).Copy
ThisWorkbook.Sheets("Consolidate").Activate
Range("A65536").End(xlUp).Offset(1, 0).PasteSpecial
Application.CutCopyMode = False
bookList.Close
Next
Bookmarks