Bonjour à tous, voila presque une heure que je ne saisi pas ou est les problème sur cette boucle :
Le probleme c'est qu'excel prend bien en compte la condition oui/oui et non/oui mais pas la condition oui/non ...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Sub Postes() Dim i As Integer Dim MyTab As Range Plig = 7 NbAg = 28 Pcol = 4 Dlig = 68 Const incr = 6 Set MyTab = Range("D7:AE68") MyTab.ClearContents Randomize i = Plig While i <= Dlig If Cells(i, 3).Value = "Oui" Then If Cells(i + 1, 3).Value = "Oui" Then Cells(i, Int(Rnd() * NbAg + Pcol)).Value = "OT#" End If ElseIf Cells(i, 3).Value = "Oui" Then If Cells(i + 1, 3).Value = "Non" Then Cells(i, Int(Rnd() * NbAg + Pcol)).Value = "OT#" End If ElseIf Cells(i, 3).Value = "Non" Then If Cells(i + 1, 3).Value = "Oui" Then Cells(i, Int(Rnd() * NbAg + Pcol)).Value = "OT#" End If Else End If i = i + incr Wend Etc ...
Bref si l'un d'entre vous à une idée et je ne doute pas que ça soit le cas je suis preneur. Etant débutant, je prends volontiers tous conseil / remarque / (compliments ... ?) .
Merci d'avance chers lecteurs;
Partager