Sub Test()
Dim Plage As Range
Dim Cel As Range
Dim Mot As String
Dim VE
Set Plage = Range("b1:b100")
Mot = "Encaisseuse"
For Each Cel In Plage
If Cel.Value = Mot Then VE = 0 Else VE = Cel.Offset(1, 2).Value: Exit For
Next Cel
MsgBox VE
End Sub
Sub Cherche()
Dim x$, c As Range
x = InputBox("Entrez le texte recherché :")
If x = "" Then Exit Sub
Set c = Cells.Find(x, , xlValues, xlPart)
x = "'" & x & "'"
If c Is Nothing Then msgbox x & " pas trouvé..." Else msgbox x & " trouvé en " & c.Address(0, 0)
End Sub
Dim O As Worksheet
Dim VE As Integer, VECB As Integer
Dim Trouve As Range
Set O = Worksheets("Feuil2")
'Valeur présente
Set Trouve = O.Cells.Find("Encaisseuse", lookat:=xlWhole)
If Trouve Is Nothing Then
VE = 0
Else
VE = Trouve.Offset(1, 2)
End If
Set Trouve = Nothing
'Valeur absente
Set Trouve = O.Cells.Find("Étiquetteuse", lookat:=xlWhole)
If Trouve Is Nothing Then
VECB = 0
Else
VECB = Trouve.Offset(1, 2)
End If
Set Trouve = Nothing
End Sub
Sub Cherche()
Dim x$, c As Range
x = InputBox("Entrez le texte recherché :")
If x = "" Then Exit Sub
Set c = Cells.Find(x, Cells(Rows.Count, Columns.Count), xlValues, xlPart)
x = "'" & x & "'"
If c Is Nothing Then msgbox x & " pas trouvé..." Else msgbox x & " trouvé en " & c.Address(0, 0)
End Sub