Q: Import .csv in excel from directory of many file types Hello I have a folder which has 82 files in it of various types (.cpg, .dpf, .csv etc...)
I want excel to go into the folder and only import the .csv files of which there should be 24 files. For some reason this seems to import 49 sheets instead of 24 and I also feel like having a for each statement then an if statement is sloppy but don't know of a better way 
Can someone please suggest a better way to do this? below is the code I used.
Sub BringInCSV()
Dim bookList As Workbook
Dim mergeObj As Object, dirObj As Object, filesObj As Object, everyObj As 
Object
Dim WS As Worksheet
Dim sheetname As String
Dim sheetname2() As String
Dim Folder As String


Application.ScreenUpdating = False
Set mergeObj = CreateObject("Scripting.FileSystemObject")


Folder = InputBox("Where are the files located?")
On Error Resume Next
Set dirObj = mergeObj.GetFolder(Folder)
Set filesObj = dirObj.Files
For Each everyObj In filesObj
 If Right(everyObj, 4) = ".csv" Then
    Set bookList = Workbooks.Open(everyObj)
    Range("A1:CO" & Range("A65536").End(xlUp).Row).Copy
    ThisWorkbook.Worksheets(1).Activate
    Set WS = Sheets.Add
    Range("A65536").End(xlUp).PasteSpecial
    Application.CutCopyMode = False
    sheetname = everyObj
    sheetname2 = Split(sheetname, "rollup_", 2)
    Sheets(ActiveSheet.Name).Name = Replace(Left(sheetname2(1),         
Len(sheetname2(1)) - 4), "_", " ")
End If
On Error Resume Next
bookList.Close

Next
End Sub


A: turns out the data was coming from a mac which was putting a bunch of hidden files in the directory so I changed the if statment to read 
 If Right(everyObj, 4) = ".csv" And Mid(everyObj, Len(Folder) + 2, 2) <> "._" Then

