Sub EnregistrerCSV()
'
' EnregistrerCSV Macro
'
Dim Veille As Date
'
ChDir "C:\Users\e.garrec\Desktop"
Sheets("Template ordre titre vif et OPC").Select
Sheets("Template ordre titre vif et OPC").Copy
ActiveWindow.SmallScroll Down:=-6
Range("E16").Select
ActiveWorkbook.SaveAs Filename:="C:\Users\e.garrec\Desktop\confirmation trade & Veille.csv", _
FileFormat:=xlCSV, CreateBackup:=False
Windows("Template ordre titre vif et OPCVM.xls").Activate
Windows("confirmation trade & Veille.csv").Activate
ActiveWindow.Close
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Range("A1").Select
End Sub
Private Function Veille() As Date
Dim d As Byte
d = DatePart("w", Date, vbSunday) 'Si Date est Dimanche ou Lundi, on prend Vendredi comme étant la veille. 'Sinon, on prend j-1
Veille = Date - IIf(d <= 2, d + 1, 1)
End Function