Salut,
J'ai besoin d'aide a propos de cet code VBA, je voulais ajouter si cellule en trouvée en colonne B non vide apparaître un message et annuler macro
Merci d'avance
Private Sub CommandButton2_Click()
ActiveSheet.Unprotect "123456"
Dim plage As Range
Dim Cell As Range
Dim Dernligne As Long
Dim L As Long
Dim coderech As String
Dernligne = Sheets("Source").Range("A" & Rows.Count).End(xlUp).Row
coderech = ComboBox1.Value
With Sheets("Source")
Set plage = .Range("A2:A" & Dernligne)
For Each Cell In plage
If Cell.Value = coderech Then
.Cells(Cell.Row, 2).Value = TextBox2.Value
End If
Next Cell
End With
TextBox2.Value = ""
ComboBox1.Value = ""
With Sheets("Source")
L = Dernligne + 1
.Cells(L, 2) = TextBox2.Value
TextBox2.Value = ""
End With
Unload Me
UserForm1.Show
End Sub