Private Sub CommandButton1_Click()
....................................................
.HorizontalAlignment = xlCenter
End With
Dim lig As Long
lig = rechercheligne("Heures", 1, Array(0, 1, 2), Array(NomTech.Value, Jour.Value, Mois.Value))
If lig <> 0 Then
Call MsgBox("Vous avez déjà renseigné la base" _
& vbCrLf & "Nom : " & NomTech.Value _
& vbCrLf & "Jour : " & Jour.Value _
& vbCrLf & "Mois : " & Mois.Value _
, vbInformation, Application.Name)
exit sub
End If
With Sheets("Heures")
...........................................
End Sub
Private Function rechercheligne(£nomfeuille As String, £colonne As Byte, £offset As Variant, £valeur As Variant)
Dim £cellule As Range
If UBound(£valeur) <> UBound(£offset) Then
Call MsgBox("Erreur ", vbCritical, Application.Name)
End If
rechercheligne = 0
For Each £cellule In Sheets(£nomfeuille).UsedRange.Columns(£colonne).Cells
For £i = LBound(£valeur) To UBound(£valeur)
£trouve = False
For £i = LBound(£valeur) To UBound(£valeur)
If CStr(£cellule.Offset(0, £offset(£i))) <> £valeur(£i) Then
£trouve = True
Exit For
End If
Next £i
If £trouve = False Then
rechercheligne = £cellule.Row
Exit For
End If
Next £cellule
End Function