Sub Get_Convar() '16-Byte accuracy ' Thanks to all @ http://www.vbaexpress.com/forum/showthread.php?52649-Process-All-CSV-Files-In-SubFolders/page3 Dim Filename As String Dim NameLength As Long Dim FileNames As Variant Dim FileLines As Variant Const F As Long = 5 'CSV field number counting from zero Dim F_Array() As Variant Dim Param_1() As Variant Dim Param_2() As Variant Dim Fn As Long 'Fn = Index number for FileNames Dim CR As Long 'CR = FileLines Index number Const FolderPath As String = "C:\TestFolder\" 'include ending \ Application.ScreenUpdating = False '<<<<<<<<<<<<<Added for speed. Comment out to watch process '''' Put all the file names in the path in Array FileNames = Filter(Split(CreateObject("wscript.shell").exec("cmd /c Dir " & _ FolderPath & "*.csv /b /s").stdout.readall, vbCrLf), ".") '''' Open one file at a time With CreateObject("scripting.filesystemobject") For Fn = 0 To UBound(FileNames) ''''Put all lines from one file in Arrays FileLines = Split(.opentextfile(FileNames(Fn)).readall, vbLf) 'Compensate for extra vbLf's in FileLines Do While FileLines(UBound(FileLines)) = "" ReDim Preserve FileLines(UBound(FileLines) - 1) Loop ReDim F_Array(UBound(FileLines)) ReDim Param_1(UBound(FileLines) - 2) ReDim Param_2(UBound(FileLines) - 2) For CR = 0 To UBound(FileLines) 'Replace file line with Log of 6th value. Split(BlahBlah)(5) F_Array(CR) = Log(Split(FileLines(CR), ",")(F)) / Log(10#) 'After the first line If CR > 0 And CR < UBound(FileLines) Then _ Param_1(CR - 1) = (F_Array(CR) - F_Array(CR - 1)) * 100 If CR > 1 Then _ Param_2(CR - 1) = (F_Array(CR) - F_Array(CR - 1)) * 100 Next CR '''' Put results in sheet 'Get FileName NameLength = Len(FileNames(Fn)) - InStrRev(FileNames(Fn), "\") Filename = Right(FileNames(Fn), NameLength) 'Place result With Sheets("Sheet1").Rows(Fn + 1) .Columns(1) = Filename '.Columns(2) = (Sum_L) '.Columns(3) = ((Sum_Q * Pie * (NumRows / NumRows - 1))) / 2) '.Columns(4) = NumRows '.Columns(5) = Sum_G '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< .Columns(8) = WorkdheetFunction(Covar(Param_1, Param_2)) End With Next Fn 'Work on next File End With Application.ScreenUpdating = True '<<<< Reset to default End Sub