Private Sub CommandButton1_Click()
' ActiveSheet.Unprotect
Dim c As Range
If ComboBox3.Value = "" Then MsgBox "Aanvrager invullen ": Exit Sub
If ComboBox1.Value = "" Then MsgBox "Taak Kiezen ": Exit Sub
If TextBox5.Value = "" Then MsgBox "werkzaamheden invullen": Exit Sub
If Textbox7.Value = "" Then MsgBox "datum invoeren": Exit Sub
If ComboBox4.Value = "" Then MsgBox "Prioriteit": Exit Sub
If TextBox9.Value = "" Then MsgBox "tijd invullen": Exit Sub
With Sheets("planning")
Set c = .Range("B" & Rows.Count).End(xlUp).Offset(1)
.Rows(8).Copy
With c.EntireRow
.PasteSpecial xlPasteFormats
.PasteSpecial xlPasteFormulas
End With
c.Value = Me.Txt_Nummer.Value 'Txt_Nummer ' aanvraagnummer
c.Offset(, 1).Value = ComboBox3 'aanvrager
c.Offset(, 6).Value = TextBox5 'werkzaamheden
[COLOR="#FF0000"]c.Offset(, 8).Value = DateValue(Textbox7) 'format(textbox1.Text,"yyyy-mm-dd") CDate(Me.Textbox7.Value) DateValue(TxtDatum) [/COLOR] c.Offset(, 13).Value = ComboBox4 'prioriteit
c.Offset(, 14).Value = ComboBox2 'Uitvoerder
c.Offset(, 5).Value = ComboBox1 'Taak
c.Offset(, 7).Value = TextBox6 'opmerking
c.Offset(, 2).Value = TextBox2 'Mail
c.Offset(, 10).Value = TextBox9 'Begin tijd
c.Offset(, 12).Value = TextBox10 'duur
c.Offset(, 19).Value = ComboBox5 'CC Mail
c.Offset(, 20).Value = TextBox11 'Opmerking CC
If OptionButton1.Value = True Then c.Offset(, 3).Value = "ja" 'stuur mail
End With
Range("B9:V9999").Select
Selection.sort Key1:=Range("J9"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("A1").Select
End Sub