1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| Function SerchXls(Myrange As Range, MyCellule As Range, strRecherche, EntierCell As Boolean, EnBoucle As Boolean) As Long '
On Error Resume Next
SerchXls = 0
If EntierCell = False Then Entier = xlPart Else Entier = xlWhole
SerchXls = Myrange.Cells.Find(What:=strRecherche, After:=MyCellule, LookIn:=xlFormulas, LookAt _
:=Entier, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=EntierCell).Row
If SerchXls <= MyCellule.Row And EnBoucle = False Then SerchXls = 0
End Function
Sub Macro1()
'...code avant
l = SerchXls(Sheets("2014 &projection").Columns("B:B"), Range("B1"), Valeur_Cherchee, True, False)
If l = 0 Then MsgBox " Pas trouvé": Exit Sub
Dealer_code = Cells(l, 2).Offset(0, -1).Value
End Sub |
Partager