1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| Sub cheminouv()
Dim Line As Integer
Line = 4
Chemin2 = ("C:\Users\OM3\AMUNDI\")
Fichier1 = ("COL" & "_OTCPOS_" & "MX_" & "EOD" & Format(Date - 3, "YYYYMMDD") & "_18*csv")
Fichier2 = ("COL" & "_OTCPOS_" & "DCL_" & "EOD" & Format(Date - 3, "YYYYMMDD") & "_18*csv")
vlook2 = "=VLOOKUP(RC[-1]," & SourceFile2 & "!RC[8]:RC[10],3,FALSE)"
SourceFile1 = Dir(Chemin2 & Fichier1)
SourceFile2 = Dir(Chemin2 & Fichier2)
ActiveSheet.range("$D$1:$D$1000").AutoFilter Field:=1, Criteria1:=("<>MATCHED")
ActiveSheet.range("$A$1:$BB$53400").AutoFilter Field:=15, Criteria1:=Array( _
"FX - Forward", "FX - Swap", "FX - NDF", _
"FX - Unspecified", "="), Operator:=xlFilterValues
With Worksheets("EXPORT_REC_TRIRESOLVE") '<~~ surely you know what worksheet you are on
With .Cells(1, 1).CurrentRegion
With .Resize(.Rows.Count - 1, .Columns.Count).Offset(1, 0)
If CBool(Application.Subtotal(103, .Cells)) Then
'there are visible cells
With .Columns(12).SpecialCells(xlCellTypeVisible)
.range("L" & Line).FormulaLocal = "=+IF(ISERROR(VLOOKUP(K" & Line & ";" & SourceFile2 & "!$T:$V;3;0));"""";VLOOKUP(K" & Line & ";" & SourceFile2 & "!$U:$V;2;0))"
If IsError(result) Then result = vlook2
End With
End If
End With
End With
End Sub |
Partager