Bonjour,
Lorsque je souhaite Actualiser les données de mon formulaire, ce qui revient pour moi (mais il y a sûrement une façon plus élégante de faire) à Supprimer puis Ajouter je suis surpris d'avoir ce message d'erreur lequel au passage précède l'arrêt d'Excel:
car j'utilise la même méthode Add que celle que j'utilise avec Ajouter et qui fonctionne parfaitement. Je joins ci-dessous le code pour Ajouter, Supprimer et Actualiser. Si vous pouviez me dire ce qui cloche dans le code pour Actualiser je vous en suis par avance très reconnaissant.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81 Private Sub BtnModifIntervenant_Click() Dim A As String Dim B As String Dim C As String Dim D As String Dim E As String Dim F As String Dim G As String If IntervenantsForm.TboNomActualiser.Value <> "" Then A = IntervenantsForm.TboNomActualiser B = IntervenantsForm.TboPrenomActualiser C = IntervenantsForm.TboTxHActualiser D = IntervenantsForm.TboTxJActualiser E = IntervenantsForm.TboRoleActualiser F = IntervenantsForm.TboEmailActualiser G = IntervenantsForm.TboTelActualiser With Liste_Intervenants ThisWorkbook.Worksheets(3).Select Application.Goto Reference:="TableauIntervenants" Selection.ListObject.ListRows(.ListIndex + 1).Delete End With ThisWorkbook.Worksheets(3).Select Application.Goto Reference:="TableauIntervenants" Range("A2:G2").Select Selection.ListObject.ListRows.Add (1) Range("A2").Select ActiveCell.Value = A ActiveCell.Offset(0, 1).Value = B ActiveCell.Offset(0, 2).Value = C ActiveCell.Offset(0, 3).Value = D ActiveCell.Offset(0, 4).Value = E ActiveCell.Offset(0, 5).Value = F ActiveCell.Offset(0, 6).Value = G End With Unload Me IntervenantsForm.Show Else Unload Me IntervenantsForm.Show End If End Sub ========================================== ========================================== Private Sub BtnAddIntervenant_Click() If IntervenantsForm.TboNom.Value <> "" Then ThisWorkbook.Worksheets(3).Select Application.Goto Reference:="TableauIntervenants" Range("A2:G2").Select Selection.ListObject.ListRows.Add (1) Range("A2").Select ActiveCell.Value = IntervenantsForm.TboNom ActiveCell.Offset(0, 1).Value = IntervenantsForm.TboPrenom ActiveCell.Offset(0, 2).Value = IntervenantsForm.TboTxH ActiveCell.Offset(0, 3).Value = IntervenantsForm.TboTxJ ActiveCell.Offset(0, 4).Value = IntervenantsForm.TboRole ActiveCell.Offset(0, 5).Value = IntervenantsForm.TboEmail ActiveCell.Offset(0, 6).Value = IntervenantsForm.TboTel Unload Me IntervenantsForm.Show Else Unload Me ========================================== ========================================== Private Sub BtnSupprIntervenant_Click() With Liste_Intervenants Application.Goto Reference:="Plage" Selection.ListObject.ListRows(.ListIndex + 1).Delete Unload Me IntervenantsForm.Show End With End Sub IntervenantsForm.Show End If End Sub
Partager