FORMULE POUR LE BOUTON AJOUTE
Dim wsForm As Worksheet
Dim wsData As Worksheet
Set wsForm = ThisWorkbook.Sheets(Formulaire )
Set wsData = ThisWorkbook.Sheets(Liste )
Dim lastRow As Long
lastRow = wsData.Cells (wsData.Rows.Count , A ) . End (xlUp) . Row + 1
wsData.Cells (lastRow , 1) . Value = wsForm.Range (D5) . Value
wsData.Cells (lastRow , 2) . Value = wsForm.Range (D5) . Value
wsData.Cells (lastRow , 3) . Value = wsForm.Range (D5) . Value
wsData.Cells (lastRow , 4) . Value = wsForm.Range (D5) . Value
wsData.Cells (lastRow , 5) . Value = wsForm.Range (D5) . Value
wsData.Cells (lastRow , 6) . Value = wsForm.Range (D5) . Value
wsData.Cells (lastRow , 7) . Value = wsForm.Range (D5) . Value
‘ vider
WsForm.Range (D , D, D, D, G, G, G, G) .Cearcontents
End Sub
FORMULE POUR LE BOUTON RECHERCHER
Dim wsForm As Worksheet
Dim wsData As Worksheet
Set wsForm = ThisWorkbook.Sheets(Formulaire )
Set wsData = ThisWorkbook.Sheets(Liste )
Dim code As String
Code = wsForm.Range (D).Value
Dim cell As Range
Set cell = wsData . Columns (A) . Find (What : = code , Lookin : =xlvalues, Lookat :xlwhole)
If Not cell Is Nothing Then
wsForm . Range (D) . Value = Cell . Offset (0 ; 1) . Value
wsForm . Range (D) . Value = Cell . Offset (0 ; 2) . Value
wsForm . Range (D) . Value = Cell . Offset (0 ; 3) . Value
wsForm . Range (G) . Value = Cell . Offset (0 ; 4) . Value
wsForm . Range (G) . Value = Cell . Offset (0 ; 5) . Value
wsForm . Range (G) . Value = Cell . Offset (0 ; 6) . Value
Else
MsBox ‘’ code non trouvé ‘’
End If
End Sub
FORMULE POUR AJOUTER BOUTON MODIFIER
Dim wsForm As Worksheet
Dim wsData As Worksheet
Set wsForm = ThisWorkbook.Sheets(Formulaire )
Set wsData = ThisWorkbook.Sheets(Liste )
Dim code As String
Code = wsForm.Range (D).Value
Dim cell As Range
Set cell = wsData . Columns (A) . Find (What : = code , Lookin : =xlvalues, Lookat :xlwhole)
If Not cell Is Nothing Then
Cell . Offset (0 ; 1) . Value = wsForm . Range (D) . value
Cell . Offset (0 ; 2) . Value = wsForm . Range (D) . value
Cell . Offset (0 ; 3) . Value = wsForm . Range (D) . value
Cell . Offset (0 ; 4) . Value = wsForm . Range (D) . value
Cell . Offset (0 ; 5) . Value = wsForm . Range (D) . value
Cell . Offset (0 ; 6) . Value = wsForm . Range (D) . value
‘ vider
WsForm.Range (D , D, D, D, G, G, G, G) .Cearcontents
Else
MsBox ‘’ code non trouvé ‘’
End If
End Sub
FORMULE POUR BOUTON SUPPRIMER
Dim wsForm As Worksheet
Dim wsData As Worksheet
Set wsForm = ThisWorkbook.Sheets(Formulaire )
Set wsData = ThisWorkbook.Sheets(Liste )
Dim code As String
Code = wsForm.Range (D).Value
Dim cell As Range
Set cell = wsData . Columns (A) . Find (What : = code , Lookin : =xlvalues, Lookat :xlwhole)
If Not Is Nothing Then
Cells . EntireRow . Delete
‘ vider
WsForm.Range (D , D, D, D, G, G, G, G) .Cearcontents
Else
MsBox ‘’ code non trouvé ‘’
End If
End Sub