1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| Dim lRange As Variant
Dim valtest As String
valtest = Application.InputBox(Msg, "entrez la valeur à rechercher", , , , , , 1)
If valtest = 0 Or valtest = "" Then Exit Sub
trouv = ""
dl = Range("A1", Columns(1).Cells.Find("*", [A1], , , , xlPrevious)).Address
Set MyVar = Cells.Find(What:=valtest, LookAt:=xlWhole)
If Not MyVar Is Nothing Then
For Each lRange In Range(dl)
If lRange.Value > valtest Then
lRange.Select
trouv = trouv & lRange
valeurtrouvée = lRange.Address
Exit For
End If
Next lRange
End If
If trouv = "" Then
MsgBox "Pas de valeur (" & valtest & ") trouvée" & Chr(10) & "dans la plage testée (" & dl & ") !"
Else
MsgBox "Valeur trouvée = " & trouv & " en " & valeurtrouvée & Chr(10) & "dans la plage testée (" & dl & ") !"
End If |
Partager