Alors désolé j'ai un nouveau petit soucis.
Je suis bien arrivé a mon but avec cette macro
[Private Sub AJOUTER_Click()
With Worksheets("TDF SERVICE")
derlign = .Range("A3000").End(xlUp).Row + 1
For i = derlign To 1 Step -1
If .Cells(i, 1) = TextBoxGRADE Then
.Rows(i + 1).Insert shift:=xlDown
.Cells(i + 1, 1).Value = TextBoxGRADE
.Cells(i + 1, 2).Value = TextBoxPERSONNEL
.Cells(i + 1, 3).Value = TextBoxPRENOM
.Cells(i + 1, 4).Value = TextBoxMATRICULE
Exit For
End If
Next
End With
End sub
Qui me permet de créer un nouveau personnel, a l'aide d'un bouton
Cependant je souhaiterais créer un bouton MODIFIER, qui crerai une ligne avec les info rentré mais qui suprimerai l'autre.
Problème avec cette macro, elle supprime toute les ligne ou apparaissent le nom.
J'ai essayé ca:
Private Sub MODIFIER_Click()
Dim rng As Range
Dim tx As String
If TextBoxPERSONNEL = "" Then Exit Sub
tx = TextBoxPERSONNEL.Value
Do
Set rng = Sheets("TDF SERVICE").Range("B:B").Find(tx)
If rng Is Nothing Then
Exit Do
Else
Sheets("TDF SERVICE").Rows(rng.Row).Delete
End If
Loop
Unload Me
With Worksheets("TDF SERVICE")
derlign = .Range("A3000").End(xlUp).Row + 1
For i = derlign To 1 Step -1
If .Cells(i, 1) = TextBoxGRADE Then
.Rows(i + 1).Insert shift:=xlDown
.Cells(i + 1, 1).Value = TextBoxGRADE
.Cells(i + 1, 2).Value = TextBoxPERSONNEL
.Cells(i + 1, 3).Value = TextBoxPRENOM
.Cells(i + 1, 4).Value = TextBoxMATRICULE
Exit For
End If
Next
End With
CHANGEMENTTDF.Hide
End Sub
Mais ca supprime les 2 lignes...