OVH Cloud OVH Cloud

Détecter l'absence d'une valeur déterminée

2 réponses
Avatar
RENAUD Eric
Bonjour,
Je souhaite rechercher dans une colonne si j'ai la valeur E via VBA

Selection.Find(What:="E", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate

Si ERREUR je ne trie sinon je trie

D'avance merci

2 réponses

Avatar
FxM
Bonjour Eric,

x = selection.find(...) sans .activate
if not x is nothing then
selection.sort (etc)
end if

@+
FxM




Bonjour,
Je souhaite rechercher dans une colonne si j'ai la valeur E via VBA

Selection.Find(What:="E", After:¬tiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:úlse).Activate

Si ERREUR je ne trie sinon je trie

D'avance merci




Avatar
papou
Bonjour
Dim LaValATrouver As Range
With Worksheets(1).Range("A1:F50")
Set LaValATrouver = .Find(What:="E", After:¬tiveCell, LookIn:=xlFormulas,
LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:úlse)
End With
'La valeur est trouvée
If Not LaValATrouver Is Nothing Then
'...ton tri
'La valeur n'est pas trouvée
Else
MsgBox "Pas trouvé dans la sélection", vbInformation, "Résultat"
End If

Cordialement
Pascal

"RENAUD Eric" <erenaud(retirerceci)@fr.fm> a écrit dans le message de news:
uZ$4VX%
Bonjour,
Je souhaite rechercher dans une colonne si j'ai la valeur E via VBA

Selection.Find(What:="E", After:¬tiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:úlse).Activate

Si ERREUR je ne trie sinon je trie

D'avance merci