Sub EONIATEST_II()
'crédits à Docmarti pour l'ouverture du CSV ;o)
Dim fCSV As Workbook, NewTxtFile As Workbook, fic, dl&
fic = Application.GetOpenFilename("Fichiers CSV (*.csv), *.csv")
If fic = False Then
Exit Sub
End If
'fige écran
Application.ScreenUpdating = False
Set fCSV = Workbooks.Open(fic, , , 2, , , True, , , , , , False, local:=True)
Set NewTxtFile = Workbooks.Add(xlWBATWorksheet)
fCSV.Sheets("page3_quot").Copy After:=NewTxtFile.Sheets(1): fCSV.Close False
With NewTxtFile
.Sheets(1).Name = "EXPORT_TXT"
With .Sheets(2)
.Name = "eonia"
.Columns("C:G").Delete: .Rows("1:8").Delete
dl = .Cells(Rows.Count, 1).End(xlUp).Row
End With
With .Sheets("EXPORT_TXT")
.Activate
.[A1] = "IN": .[B1] = "EON"
.[C1].FormulaR1C1 = "=TEXT(eonia!RC[-2],""aaaammjj"")"
.[D1].FormulaR1C1 = "=eonia!RC[-2]": .[E1].FormulaR1C1 = "=eonia!RC[-3]"
.Range("A1:E1").Select
Application.Goto Reference:="R1C1:R" & dl & "C5"
Selection.FillDown
.UsedRange.Value = .UsedRange.Value
End With
Application.DisplayAlerts = False 'inhibe alert message
.Sheets(2).Delete
Application.DisplayAlerts = True
End With
Application.ScreenUpdating = True
End Sub