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
| Option Explicit
'UP
Private Sub cmbDown_Click()
Dim intPosition
intPosition = RecupererIndice(Cells(1, 2))
If intPosition - 1 >= 1 Then
intPosition = intPosition - 1
Cells(1, 2).Value = Application.Index(Range("liste_validation"), intPosition)
End If
End Sub
'DOWN
Private Sub cmbUP_Click()
Dim intPosition
intPosition = RecupererIndice(Cells(1, 2))
If intPosition + 1 <= Range("liste_validation").Cells.Count Then
intPosition = intPosition + 1
Cells(1, 2).Value = Application.Index(Range("liste_validation"), intPosition)
End If
End Sub
'Récupérer Index
Private Function RecupererIndice(rngCell As Range) As Integer
RecupererIndice = Application.Match(rngCell.Value, Range("liste_validation"), 0)
End Function |
Partager