Sub Volgende_click()
frmGegevensAanpassen.Hide
End Sub
Sub Aanpassen_Click()
nn = ComboBox1.Value
With Sheets("Herhalers")
Set nnFound = .Columns(2).Find(What:=nn, After:=.Cells(7, 2), LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
nnFound.Value = TextBox1.Value
nnFound.Offset(, 1).Value = TextBox2.Value
nnFound.Offset(, 4).Value = TextBox3.Value
nnFound.Offset(, 5).Value = TextBox5.Value
nnFound.Offset(, 3).Value = TextBox4.Value
nnFound.Offset(, 6).Value = TextBox6.Value
nnFound.Offset(, 7).Value = TextBox7.Value
nnFound.Offset(, 8).Value = TextBox8.Value
nnFound.Offset(, 9).Value = TextBox9.Value
nnFound.Offset(, 12).Value = TextBox10.Value
nnFound.Offset(, 13).Value = TextBox11.Value
nnFound.Offset(, 14).Value = TextBox12.Value
End With
End Sub
Sub Annuleren_click()
frmGegevensAanpassen.Hide
End Sub
Sub UserForm_Initialize()
Dim rCell As Range
Set colParms2 = New Collection
ComboBox1.Clear
For Each rCell In Range("B7:B100")
If rCell.Value <> vbNullString Then
ComboBox1.AddItem rCell.Value
colParms2.Add rCell.Offset(, 1).Value
End If
Next rCell
End Sub
Private Sub ComboBox1_Change()
frmGegevensAanpassen.TextBox1.Value = ComboBox1
If Me.ComboBox1.ListIndex <> -1 Then
frmGegevensAanpassen.TextBox2.Text = Worksheets("Herhalers").[B7:B100].Find(Me.ComboBox1.List(Me.ComboBox1.ListIndex)).Offset(0, 1).Text
frmGegevensAanpassen.TextBox3.Text = Worksheets("Herhalers").[B7:B100].Find(Me.ComboBox1.List(Me.ComboBox1.ListIndex)).Offset(0, 4).Text
frmGegevensAanpassen.TextBox5.Text = Worksheets("Herhalers").[B7:B100].Find(Me.ComboBox1.List(Me.ComboBox1.ListIndex)).Offset(0, 5).Text
frmGegevensAanpassen.TextBox11.Text = Worksheets("Herhalers").[B7:B100].Find(Me.ComboBox1.List(Me.ComboBox1.ListIndex)).Offset(0, 13).Text
frmGegevensAanpassen.TextBox4.Text = Worksheets("Herhalers").[B7:B100].Find(Me.ComboBox1.List(Me.ComboBox1.ListIndex)).Offset(0, 3).Text
frmGegevensAanpassen.TextBox6.Text = Worksheets("Herhalers").[B7:B100].Find(Me.ComboBox1.List(Me.ComboBox1.ListIndex)).Offset(0, 6).Text
frmGegevensAanpassen.TextBox7.Text = Worksheets("Herhalers").[B7:B100].Find(Me.ComboBox1.List(Me.ComboBox1.ListIndex)).Offset(0, 7).Text
frmGegevensAanpassen.TextBox8.Text = Worksheets("Herhalers").[B7:B100].Find(Me.ComboBox1.List(Me.ComboBox1.ListIndex)).Offset(0, 8).Text
frmGegevensAanpassen.TextBox9.Text = Worksheets("Herhalers").[B7:B100].Find(Me.ComboBox1.List(Me.ComboBox1.ListIndex)).Offset(0, 9).Text
frmGegevensAanpassen.TextBox10.Text = Worksheets("Herhalers").[B7:B100].Find(Me.ComboBox1.List(Me.ComboBox1.ListIndex)).Offset(0, 12).Text
frmGegevensAanpassen.TextBox12.Text = Worksheets("Herhalers").[B7:B100].Find(Me.ComboBox1.List(Me.ComboBox1.ListIndex)).Offset(0, 14).Text
End If
End Sub
Private Sub OkSluit_Click()
Dim strLastRow As Integer
'Get last row
xllastrow = Range("B" & Rows.Count).End(xlUp).Row
strLastRow = xllastrow
With frmGegevensAanpassen
'If textboxes not null then fill data of textboxes to worksheet.
If (.TextBox1.Value <> vbNullString And .TextBox2.Value <> vbNullString) Then
Cells(strLastRow + 1, 2).Value = frmGegevensAanpassen.TextBox1.Value
Cells(strLastRow + 1, 3).Value = frmGegevensAanpassen.TextBox2.Value
Cells(strLastRow + 1, 6).Value = frmGegevensAanpassen.TextBox3.Value
Cells(strLastRow + 1, 5).Value = frmGegevensAanpassen.TextBox4.Value
Cells(strLastRow + 1, 7).Value = frmGegevensAanpassen.TextBox5.Value
Cells(strLastRow + 1, 8).Value = frmGegevensAanpassen.TextBox6.Value
Cells(strLastRow + 1, 9).Value = frmGegevensAanpassen.TextBox7.Value
Cells(strLastRow + 1, 10).Value = frmGegevensAanpassen.TextBox8.Value
Cells(strLastRow + 1, 11).Value = frmGegevensAanpassen.TextBox9.Value
Cells(strLastRow + 1, 14).Value = frmGegevensAanpassen.TextBox10.Value
Cells(strLastRow + 1, 15).Value = frmGegevensAanpassen.TextBox11.Value
Cells(strLastRow + 1, 16).Value = frmGegevensAanpassen.TextBox12.Value
strLastRow = strLastRow + 1
'Empty textboxes
.TextBox1.Value = vbNullString
.TextBox2.Value = vbNullString
.TextBox3.Value = vbNullString
.TextBox4.Value = vbNullString
.TextBox5.Value = vbNullString
.TextBox6.Value = vbNullString
.TextBox7.Value = vbNullString
.TextBox8.Value = vbNullString
.TextBox9.Value = vbNullString
.TextBox10.Value = vbNullString
.TextBox11.Value = vbNullString
.TextBox12.Value = vbNullString
Else
MsgBox "Voer gegevens in!"
End If
End With
Unload Me
'Cells.Select
' Selection.Sort Key1:=Range("B7"), Order1:=xlAscending,
'Range("B8").Select
End Sub