1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| Function searchAgent(ByRef ws As Worksheet, ByVal recherche As String) As Integer
tmp_range = "A1:A" & ws.UsedRange.Rows.Count
With ws.Range(tmp_range)
Set c = .Find(recherche, LookIn:=xlValues)
If Not c Is Nothing Then
firstaddress = c.Address
Do
searchAgent = c.Row
Exit Function
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstaddress
End If
End With
End Function
Function searchAgent2(ByRef ws As Worksheet, ByVal recherche As String) As Integer
tmp_range = "B11:AZ11"
With ws.Range(tmp_range)
Set w = .Find(recherche, LookIn:=xlValues)
If Not w Is Nothing Then
firstaddress = w.Address
Do
searchAgent2 = w.Column
Exit Function
Set w = .FindNext(w)
Loop While Not w Is Nothing And w.Address <> firstaddress
End If
End With
End Function |
Partager