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 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
| Dim Cptr3, JourN, CptB, CodJ, DP As String
Dim cz3, cz4, cz5, cz6, cz7 As Range
' **** on aajoute une ligne !
If Frame1.Caption = "Ajout d'une table !" Then
' on vérifie qu'il nexiste pas une table identique
JourN = C1
Set cz4 = Sheets("tablBle").Columns("L:L").find(What:=JourN, LookAt:=xlWhole)
If cz4 Is Nothing Then
Else
MsgBox " Le Libellé ' Table ' existe déja ! Modifier le !"
Exit Sub
End If
' on vérifie qu'il nexiste pas un code Tiers identique
CptB = C3
Set cz5 = Sheets("tablBle").Columns("p:p").find(What:=CptB, LookAt:=xlWhole)
If cz5 Is Nothing Then
Else
MsgBox " Le code tiers doit-être différent des autres tables ! Modifier le !"
Exit Sub
End If
' on vérifie qu'il nexiste pas un code table identique
CodJ = C5
Set cz6 = Sheets("tablBle").Columns("M:M").find(What:=CodJ, LookAt:=xlWhole)
If cz6 Is Nothing Then
Else
MsgBox " Le Libellé ' Code Table ' existe déja sur une autre table! Modifier le !"
Exit Sub
End If
' on vérifie qu'il nexiste pas un code Table identique
DP = C6
Set cz7 = Sheets("tablBle").Columns("N:N").find(What:=DP, LookAt:=xlWhole)
If cz7 Is Nothing Then
Else
MsgBox " Le Libellé ' Lettre Table ' existe déja sur une autre tablel! Modifier le !"
Exit Sub
End If
Dim Der_ligne As Integer
Der_ligne = Sheets("tablBle").Range("L19").End(xlUp).Row + 1
Cells(Der_ligne, 12) = C1
Cells(Der_ligne, 11) = C2
Cells(Der_ligne, 13) = C5
Cells(Der_ligne, 14) = C6
Cells(Der_ligne, 15) = C4
Cells(Der_ligne, 16) = C3
Cells(Der_ligne, 17) = C7
C1.Locked = False
C2.Locked = False
C3.Locked = False
C5.Locked = False
C6.Locked = False
C1.BackColor = &HFFFFFF
C2.BackColor = &HFFFFFF
C3.BackColor = &HFFFFFF
C5.BackColor = &HFFFFFF
C6.BackColor = &HFFFFFF
C1 = ""
C2 = ""
C3 = ""
C4 = ""
C5 = ""
C6 = ""
C7 = ""
End If
' *****on recherche la ligne à modifier******
If Frame1.Caption = " Modification d'une Table !" Then
Cptr3 = MemoirJournal
Set cz3 = Sheets("tablBle").Columns("L:L").find(What:=Cptr3, LookAt:=xlWhole)
If cz3 Is Nothing Then
MsgBox " Ne trouve pas la Table !"
Else
cz3.Offset(0, 0) = C1
cz3.Offset(0, -1) = C2
cz3.Offset(0, 1) = C5
cz3.Offset(0, 2) = C6
cz3.Offset(0, 3) = C4
cz3.Offset(0, 4) = C3
cz3.Offset(0, 5) = C7
C1 = ""
C2 = ""
C3 = ""
C4 = ""
C5 = ""
C6 = ""
C7 = ""
MemoirTable = "" 'Label
Frame1.Caption = " Modification d'une table ?"
End If
End If
Liste_table' on actualise la listbox |
Partager