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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
| Sub Bouton108_Clic()
'_____variable__________
Dim budjet2 As Double
Dim budjet As Double
Dim b As Double ' variable pour la boucle
Dim z2 As Double
Dim a2 As Double
Dim y As Double
Dim y2 As Double
Dim a As Double
Dim z As Double
Dim tab_ex(200, 0) ' tableau dynamique
'Ouverture de l'application
Dim wb As Workbook
Dim ws As Worksheet
Set wb = Workbooks.Open("LIEN OMISE PARTIE CONFIDENTIEL /lpl.xls")
Set ws = wb.Worksheets(1)
Windows("Copie de Réquisitionsv3dyn.xlsm").Activate 'activer réquisition
'___________________TEST TABLEAUX DYNAMIQUE_____________________'
Windows("Copie de 2013-Budget B&S-GB pour lpl.xls").Activate ' retourner budget
For i = 0 To 175
tab_ex(i, 0) = Range("J" & i + 10)
seek tab_ex (" ") as
End If
Next
'_____________PARTIE STATIQUE__________
'________22523___________
Windows(" lpl.xls").Activate ' retourner budget
Range("J66").Select
budjet = ActiveCell.Value
Windows("Copie de Réquisitionsv3dyn.xlsm").Activate ' retour dans requisition
Range("A1").Select
ActiveCell.Value = a
'________22001___________
Windows("r lpl.xls").Activate ' retourner budget
Range("J11").Select
budjet2 = ActiveCell.Value
Windows("Copie de Réquisitionsv3dyn.xlsm").Activate ' retour dans requisition
Range("A1").Select
ActiveCell.Value = a2
'_____ boucle de recherche_____
For b = 0 To 1000
'________22523___________
Range("F10").Select
ActiveCell.Offset(b, 0).Select
If ActiveCell.Value = budjet Then
z = ActiveCell.Offset(0, 1).Value
a = a + z
End If
'________22031___________
Range("F10").Select
ActiveCell.Offset(b, 0).Select
If ActiveCell.Value = budjet Then
z = ActiveCell.Offset(0, 1).Value
a = a + z
End If
'________22001___________
Range("F10").Select
ActiveCell.Offset(b, 0).Select
If ActiveCell.Value = budjet2 Then
z2 = ActiveCell.Offset(0, 1).Value
a2 = a2 + z2
End If
Next
Range("A10").Select
'________22523___________
Windows(" lpl.xls").Activate
Range("K66").Select
y = ActiveCell.Offset(0, -6).Value
a = y - a
If (a < 0) Then
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveCell.FormulaR1C1 = ""
ActiveCell.Offset(0, 0).Select
ActiveCell.Value = a
Else
ActiveCell.FormulaR1C1 = ""
ActiveCell.Offset(0, 0).Select
ActiveCell.Value = a
End If
'________22001___________
Windows(" lpl.xls").Activate
Range("K11").Select
y2 = ActiveCell.Offset(0, -6).Value
a2 = y2 - a2
If (a2 < 0) Then
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveCell.FormulaR1C1 = ""
ActiveCell.Offset(0, 0).Select
ActiveCell.Value = a2
Else
ActiveCell.FormulaR1C1 = ""
ActiveCell.Offset(0, 0).Select
ActiveCell.Value = a2
End If
End Sub |