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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| Sub import()
'ouverture du fichier
Dim Cls_1 As Workbook
Dim Cls_2 As Workbook
Dim sChemin
Application.ScreenUpdating = False
Application.DisplayAlerts = False
sChemin = Application.GetOpenFilename
If sChemin = False Then Exit Sub
'Matching
'Morgan Stanley
Set Cls_1 = Workbooks.Open(sChemin)
lignemax1 = Range("a7").End(xlDown).Row
For p = 7 To lignemax1
sens1 = Cells(p, 2)
If sens1 = "buy" Then
sens1 = "b"
ElseIf sens1 = "sell" Then
sens1 = "s"
End If
prix_exec1 = Cells(p, 10).Value
commission1 = Cells(p, 12).Value
quantite1 = Cells(p, 9).Value
'Main courante
Set Cls_2 = ActiveWorkbook
lignemax2 = Range("b5").End(xlDown).Row
For i = 5 To lignemax2
If Cells(i, 3).Value = sens1 Then
If Cells(i, 7).Value = prix_exec1 Then
If Cells(i, 11).Value = commission1 Then
If Cells(i, 4).Value = quantite1 Then
Cells(i, 14).Value = "JM"
End If
End If
End If
End If
Next i
Next p
End Sub |
Partager