Try this
Code:Sub OpenAndModifySameFileTypes() Dim strFile As String Dim strFileType As String Dim strPath As String Dim lngLoop As Long strPath = "C:\Journals" strFileType = "*.csv" 'Split with semi-colon if you want to specify the file types. Example ->> "*.xls;*.jpeg;*.doc;*.gif" For lngLoop = LBound(Split(strFileType, ";")) To UBound(Split(strFileType, ";")) strFile = Dir(strPath & "\" & Split(strFileType, ";")(lngLoop)) Do While strFile <> "" With Workbooks.Open(strPath & "\" & strFile) With .Sheets(1) .Range("B1:D" & .UsedRange.Rows.Count).NumberFormat = "0.00" End With .Close 1 End With strFile = Dir Loop Next lngLoop strFile = vbNullString strFileType = vbNullString strPath = vbNullString lngLoop = Empty End Sub




Reply With Quote
Bookmarks