1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| Sub rechercheAvecSearchFormat()
Dim rngSearch As Range, rngFindValue As Range
'set the search range:
Set rngSearch = ActiveSheet.Range("A:A")
Application.FindFormat.Clear
Application.FindFormat.NumberFormat = "#,##0"
Set rngFindValue = rngSearch.Find(What:=2055, LookIn:=xlValues, SearchFormat:=True)
MsgBox rngFindValue.Address 'Génère une erreur
Set rngFindValue = rngSearch.Find(What:=2055, LookIn:=xlFormulas, SearchFormat:=True)
MsgBox rngFindValue.Address 'OK
Set rngFindValue = rngSearch.Find(What:=1024, LookIn:=xlValues, SearchFormat:=True)
MsgBox rngFindValue.Address 'Génère une erreur
Set rngFindValue = rngSearch.Find(What:=1024, LookIn:=xlFormulas, SearchFormat:=True)
MsgBox rngFindValue.Address 'Génère une erreur
End Sub |
Partager