1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| Private Sub rech_article()
Dim Message As String
Dim mon_article As String
Dim c As Range
Dim sh As Worksheet
Message = "Entrez le nom de l'article"
mon_article = InputBox(Message)
' boucle sur toutes les feuilles
For Each sh In Workbooks("offre de prix.xls").Sheets
' l'article à chercher est dans la collone B
With sh.Range("b:b")
Set c = .Find(mon_article, , LookIn:=xlValues, Lookat:=xlWhole)
If Not c Is Nothing Then
sh.Activate
' sélectionne la ligne de l'article demandé
sh.Range(c.Row & ":" & c.Row).Select
Exit Sub
End If
End With
Next sh
MsgBox "L'article """ & mon_article & """ n'existe pas"
End Sub |
Partager