Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dear All,
The macro below opens a number of text file with *.mea extension, doe some calculation (average and std deviation). What I would like to d is save the file with *.xls extension after calculation is done. I' sure it will be adding a 1 or more lines of code. Hope anyone ca help. Regards, Bharesh Mandalia Sub BatchProcessor() With Application.FileSearch .NewSearch .LookIn = "d:\activeb\" '(insert proper file directory) .SearchSubFolders = True .FileName = "ms1*.mea" .MatchTextExactly = True .FileType = msoFileTypeAllFiles If .Execute() 0 Then ' MsgBox "There were " & .FoundFiles.Count & "file(s) found." For I = 1 To .FoundFiles.Count Workbooks.Open FileName:=.FoundFiles(I) With ActiveWorkbook Columns("A:A").EntireColumn.AutoFit Columns("A:A").Select Selection.TextToColumns Destination:=Range("A1") DataType:=xlFixedWidth, _ FieldInfo:=Array(Array(0, 1), Array(16, 1)) Selection.AutoFilter Range("B1").Select Selection.AutoFilter Field:=1, Criteria1:="Dist" Range("B2:B65536").Select Selection.NumberFormat = "0.0000" Selection.NumberFormat = "0.000" Selection.Copy Range("D1").Select ActiveSheet.Paste Application.CutCopyMode = False Selection.AutoFilter Field:=1 Range("E1").Select ActiveCell.FormulaR1C1 = "=AVERAGE(C[-1])" Range("F1").Select ActiveCell.FormulaR1C1 = "=COUNT(C[-2])" Range("F2").Select End With Next I Else MsgBox "There were no files found" End If End Wit -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I save date format: dd mmm yyyy as a csv file? | Excel Discussion (Misc queries) | |||
How to save word file in PDF format | Charts and Charting in Excel | |||
Save Excel File in Other Format | Excel Discussion (Misc queries) | |||
how do I save a column to a file (in ascii format) | Excel Discussion (Misc queries) | |||
How do I save format changes in a comma delimited file? | Excel Worksheet Functions |