Bonjour le forum et Porcinet82
Voici ma solution :
Private Sub CommandButton1_Click()
If UserForm1.cd = False And UserForm1.dvd = False And UserForm1.dvdgrave = False Then
MsgBox 'Veuillez sélectionner cd, dvd ou dvd grave', vbInformation, 'DVDTHEQUE'
Exit Sub
End If
If UserForm1.TextBox1 = '' Then
MsgBox 'Veuillez saisir la date', vbInformation, 'DVDTHEQUE'
UserForm1.TextBox1.SetFocus
Exit Sub
End If
If UserForm1.TextBox2 = '' Then
MsgBox 'Veuillez saisir le titre du film', vbInformation, 'DVDTHEQUE'
UserForm1.TextBox2.SetFocus
Exit Sub
End If
If UserForm1.ComboBox1.ListIndex = -1 Then
MsgBox 'Veuillez sélectionner le genre du film', vbInformation, 'DVDTHEQUE'
UserForm1.ComboBox1.SetFocus
Exit Sub
End If
If UserForm1.ComboBox2.ListIndex = -1 Then
MsgBox 'Veuillez sélectionner le nombre de cd ', vbInformation, 'DVDTHEQUE'
UserForm1.ComboBox2.SetFocus
Exit Sub
End If
If UserForm1.ComboBox3.ListIndex = -1 Then
MsgBox 'Veuillez sélectionner le support', vbInformation, 'DVDTHEQUE'
UserForm1.ComboBox3.SetFocus
Exit Sub
End If
If dvd = True Then
Sheets('dvd').Range('c65536').End(xlUp).Offset(1, 0).Value = TextBox1.Value
Sheets('dvd').Range('d65536').End(xlUp).Offset(1, 0).Value = TextBox2.Value
Sheets('dvd').Range('e65536').End(xlUp).Offset(1, 0).Value = ComboBox1.Value
Sheets('dvd').Range('f65536').End(xlUp).Offset(1, 0).Value = ComboBox2.Value
Sheets('dvd').Range('g65536').End(xlUp).Offset(1, 0).Value = ComboBox3.Value
ElseIf cd = True Then
Sheets('cd').Range('c65536').End(xlUp).Offset(1, 0).Value = TextBox1.Value
Sheets('cd').Range('d65536').End(xlUp).Offset(1, 0).Value = TextBox2.Value
Sheets('cd').Range('e65536').End(xlUp).Offset(1, 0).Value = ComboBox1.Value
Sheets('cd').Range('f65536').End(xlUp).Offset(1, 0).Value = ComboBox2.Value
Sheets('cd').Range('g65536').End(xlUp).Offset(1, 0).Value = ComboBox3.Value
ElseIf dvdgrave = True Then
Sheets('DVDGRAVE').Range('c65536').End(xlUp).Offset(1, 0).Value = TextBox1.Value
Sheets('DVDGRAVE').Range('d65536').End(xlUp).Offset(1, 0).Value = TextBox2.Value
Sheets('DVDGRAVE').Range('e65536').End(xlUp).Offset(1, 0).Value = ComboBox1.Value
Sheets('DVDGRAVE').Range('f65536').End(xlUp).Offset(1, 0).Value = ComboBox2.Value
Sheets('DVDGRAVE').Range('g65536').End(xlUp).Offset(1, 0).Value = ComboBox3.Value
Else
'MsgBox 'Veuillez choisir entre cd, DVDGRAVE et dvd'
Exit Sub
End If
cd = False
dvd = False
dvdgrave = False
TextBox1 = ''
TextBox2 = ''
ComboBox1 = ''
ComboBox2 = ''
ComboBox3 = ''
End Sub
Est elle fiable ?
Merci en tout cas pour toute l'aide déjà apportée
Bonne journée et bon week end
Hélène