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
| Sub Steve_mcn()
Dim CreaClientWO As Variant
Set f = Sheets("Liste Clients")
CreaClientWO = "Le client6"
result = CreaCliDoublValid(f, CreaClientWO, LigneVideClients)
If result = False Then
f.Cells(LigneVideClients, "B").NumberFormat = ""
f.Cells(LigneVideClients, "B").Value = CreaClientWO
End If
End Sub
Private Function CreaCliDoublValid(f, CreaClientWO, LigneVideClients) As Boolean
Dim i As Long
Dim bB As Range
Dim z As Range
LigneVideClients = f.Cells(Rows.Count, "B").End(xlUp).Row + 1
i = f.Cells(Rows.Count, "B").End(xlUp).Row
Set bB = f.Range(f.Cells(2, "B"), f.Cells(i, "B"))
Set z = bB.Find(what:=CreaClientWO, LookIn:=xlFormulas, Lookat:=xlWhole, MatchCase:=False)
If Not z Is Nothing Then
CreaCliDoublValid = True
Else
CreaCliDoublValid = False
End If
Set bB = Nothing
Set z = Nothing
End Function |
Partager