Hi weet iemand misschien hoe ik deze blokken korter kan maken, liefst naar 1 blok, elementaire logica is niet echt mijn sterkste punt , alvast bedankt.
Code:
If CheckBox1 Then
Worksheets("Boekclub").Select
erow = Sheets("Boekclub").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Cells(erow, 1) = ComboBox1.Text
Cells(erow, 2) = TextBox2.Text
Cells(erow, 3) = TextBox3.Text
Cells(erow, 4) = TextBox4.Text
Cells(erow, 5) = TextBox5.Text
'TextBox6.Text = Format(TextBox6.Text, "dd/mmm/yyyy")
Cells(erow, 6) = Date
Worksheets("Main Database").Select
erow = Sheets("Main Database").Cells(Rows.Count, 1).End(xlUp).Offset(0, 0).Row
Cells(erow, 8) = "ja"
Cells(erow, 8).Interior.ColorIndex = 3
End If
If CheckBox2 Then
Worksheets("Tennis").Select
erow = Sheets("Tennis").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Cells(erow, 1) = ComboBox1.Text
Cells(erow, 2) = TextBox2.Text
Cells(erow, 3) = TextBox3.Text
Cells(erow, 4) = TextBox4.Text
Cells(erow, 5) = TextBox5.Text
'TextBox6.Text = Format(TextBox6.Text, "dd/mmm/yyyy")
Cells(erow, 6) = Date
Worksheets("Main Database").Select
erow = Sheets("Main Database").Cells(Rows.Count, 1).End(xlUp).Offset(0, 0).Row
Cells(erow, 9) = "ja"
End If
If CheckBox3 Then
Worksheets("Gitaar").Select
erow = Sheets("Gitaar").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Cells(erow, 1) = ComboBox1.Text
Cells(erow, 2) = TextBox2.Text
Cells(erow, 3) = TextBox3.Text
Cells(erow, 4) = TextBox4.Text
Cells(erow, 5) = TextBox5.Text
'TextBox6.Text = Format(TextBox6.Text, "dd/mmm/yyyy")
Cells(erow, 6) = Date
Worksheets("Main Database").Select
erow = Sheets("Main Database").Cells(Rows.Count, 1).End(xlUp).Offset(0, 0).Row
Cells(erow, 10) = "ja"
End If
If CheckBox4 Then
Worksheets("Keyboard").Select
erow = Sheets("Keyboard").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Cells(erow, 1) = ComboBox1.Text
Cells(erow, 2) = TextBox2.Text
Cells(erow, 3) = TextBox3.Text
Cells(erow, 4) = TextBox4.Text
Cells(erow, 5) = TextBox5.Text
'TextBox6.Text = Format(TextBox6.Text, "dd/mmm/yyyy")
Cells(erow, 6) = Date
Worksheets("Main Database").Select
erow = Sheets("Main Database").Cells(Rows.Count, 1).End(xlUp).Offset(0, 0).Row
Cells(erow, 11) = "ja"
End If
If CheckBox5 Then
Worksheets("Vrijwilligerswerk").Select
erow = Sheets("Vrijwilligerswerk").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Cells(erow, 1) = ComboBox1.Text
Cells(erow, 2) = TextBox2.Text
Cells(erow, 3) = TextBox3.Text
Cells(erow, 4) = TextBox4.Text
Cells(erow, 5) = TextBox5.Text
'TextBox6.Text = Format(TextBox6.Text, "dd/mmm/yyyy")
Cells(erow, 6) = Date
Worksheets("Main Database").Select
erow = Sheets("Main Database").Cells(Rows.Count, 1).End(xlUp).Offset(0, 0).Row
Cells(erow, 12) = "ja"
End If
Laatst bewerkt: