Bonjour, je suis en train de coder un jeu pour quatre équipes : écureuil, castor, lion, milan,
Je souhaite, lorsque j'appuie sur un bouton que le mot mine apparaissent en dessous de fer et que les ressources se retirent automatiquement ( 200 de bois et 100 d'argile)
Ma boucle fonctionne parfaitement pour Ecureuil mais ne fonctionne pas pour Castor Lion et Milan.
Pouvez vous m'aider ?
Merci beaucoup,
Dim m As Variant
m = Array("Ecureuil", "Castor", "Lion", "Milan")
For i = 0 To 3
j = m(i)
If [S13].Value = "Mine" And [U13].Value = j Then
For n = 16 To 36
If Cells(n, 5 + 2 * i).Value = "FER" Then
If Cells(n + 1, 5 + 2 * i).Value <> "" Then
Range(Cells(n + 1, 4), Cells(n + 1, 12)).Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
For k = 5 To 11 Step 2
Range(Cells(n + 1, k), Cells(n + 1, k + 1)).Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Next k
Cells(14, 5 + 2 * i) = Cells(14, 5 + 2 * i) + 1
Cells(9, 13 + i) = Cells(9, 13 + i) + 10
End If
Cells(n + 1, 5 + 2 * i).Value = "Mine"
Cells(9, 13 + i) = Cells(9, 13 + i) + 40
Cells(7, 5 + 2 * i) = Cells(7, 5 + 2 * i) - 200
Cells(8, 5 + 2 * i) = Cells(8, 5 + 2 * i) - 100
Else
n = n + 1
End If
Next n
Else
i = i + 1
End If
Next i
End Sub