Private Sub CmdValider_Click()
If Trim(TxtTitre) = "" Then
MsgBox "Entrez le titre du Livre!", vbOKOnly, "Attention"
Me.TxtTitre.SetFocus
Exit Sub
End If
'
If Trim(TxtAuteur) = "" Then
MsgBox "Entrez l'auteur du Livre!", vbOKOnly, "Attention"
Me.TxtAuteur.SetFocus
Exit Sub
End If
'
If Trim(CmbCollection) = "" Then
MsgBox "Entrez la collection!", vbOKOnly, "Attention"
Me.CmbCollection.SetFocus
Exit Sub
End If
'
If Trim(CmbEdition) = "" Then
MsgBox "Entrez l'édition!", vbOKOnly, "Attention"
Me.CmbEdition.SetFocus
Exit Sub
End If
'
If Trim(CmbCatégorie) = "" Then
MsgBox "Entrez la catégorie!", vbOKOnly, "Attention"
Me.CmbCatégorie.SetFocus
Exit Sub
End If
'
If Trim(TxtDateAchat) = "" Then
MsgBox "Entrez la date d'achat!", vbOKOnly, "Attention"
Me.TxtDateAchat.SetFocus
Exit Sub
End If
'
If Trim(TxtPrixAchat) = "" Then
MsgBox "Entrez le prix d'achat!", vbOKOnly, "Attention"
Me.TxtPrixAchat.SetFocus
Exit Sub
End If
'--------------------------------------------------------------
On Error Resume Next
[B]With [COLOR=Red]Sheets("Livres").[/COLOR]Range("B65536").End(xlUp).Offset(1, -1)
.ShapeRange.LockAspectRatio = msoTrue
.ShapeRange.Height = 70[/B]
.RowHeight = 14
.EntireRow.VerticalAlignment = xlCenter
.Offset(0, 0).Value = Application.Max(Worksheets("Livres").Range("A3:A65536")) + 1
.Offset(0, 1).Value = TxtTitre
.Offset(0, 2).Value = TxtAuteur
.Offset(0, 3).Value = CmbCollection
.Offset(0, 4).Value = CmbCatégorie
.Offset(0, 5).Value = CmbEdition
If Trim(TxtDateAchat) <> "" Then .Offset(0, 6).Value = DateValue(TxtDateAchat)
If TxtPrixAchat <> "" Then .Offset(0, 7).Value = CDbl(TxtPrixAchat.Value)
End With
Unload FrmLivres
End Sub