Bonjour à tous !
Voila mon soucy :
J'ai un inventaire de 8000 dispositifs médicaux, et j'aimerais les trier.
Je suis pas débutant en VBA mais pas pro non plus
Je voudrais incrémenter un compteur dans le code vba mais
il faudrait qu'il prenne en compte le tri (automatique) effectué par un utilisateur...
Y-a-t-il une fonction qui selectionne seulement les lignes triées ?
Merci de prendre du temps pour m'aider !
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 Private Sub CommandButton1_Click() Dim ws As Worksheet Dim i As Long Dim Compteur1 As Integer Dim Compteur2 As Integer Set ws = Worksheets("LISTE") With ws i = 9 While .Range("E" & i).Value <> "fin" If .Range("E" & i).Value = "OUI" Then .Rows(i).Interior.ColorIndex = 43 End If If .Rows(i).Interior.ColorIndex = 43 Then .Range("E" & i).Value = "OUI" End If If .Range("E" & i).Value = "OUI" Or .Rows(i).Interior.ColorIndex = 43 Then Compteur1 = Compteur1 + 1 If .Range("E" & i).Value <> "OUI" Or .Rows(i).Interior.ColorIndex <> 43 Then .Range("E" & i).Value = "NON" Compteur2 = Compteur2 + 1 End If i = i + 1 Wend End With Cells(5, "F") = Compteur1 Cells(6, "F") = Compteur2 Cells(6, "H") = Now MsgBox ("Mise à jour effectuée avec succès !") End Sub
Partager