Goedemorgen allen,
Ik probeer een userform in te voegen die data inleest vanuit sheet 3 en 10. Dit zijn gegevens van studenten.
Die zou ik graag overzichtelijk willen maken ahv een userform, zodat de gegevens makkelijk aangepast en ingevoerd kunnen worden.
Op dit moment ziet het laden van het userform er als volgt uit:
Als ik dan echter het Userform oproep dmv StudentUserForm.show krijg ik de runtime error 91: object or with block variable not set.
Ik zie even niet hoe dat komt.
zou iemand mij kunnen helpen?
Alvast heel erg bedankt!
Groet,
Bernice
Ik probeer een userform in te voegen die data inleest vanuit sheet 3 en 10. Dit zijn gegevens van studenten.
Die zou ik graag overzichtelijk willen maken ahv een userform, zodat de gegevens makkelijk aangepast en ingevoerd kunnen worden.
Op dit moment ziet het laden van het userform er als volgt uit:
Code:
Private Sub UserForm_Initialize()
Application.ScreenUpdating = False
Dim Rij As Range
Dim Row As Range
Rij = ActiveCell.Row
If Cells(Rij, 2) Is Cells.Range("B6:B55") & Not Cells(Rij, 2) Is Nothing Then
Row = ActiveCell.Row
Else:
Row = Sheet3.Cells(Rows.Count, 2).End(xlUp).Offset(1).Row
End If
NaamTextBox.Value = Cells(Row, "B").Value
InstellingTextBox.Value = Cells(Row, "C").Value
HoofdTextBox.Value = Cells(Row, "E").Value
TeamTextBox.Value = Cells(Row, "D").Value
KlinischPage.Visible = True
AfspraakTextBox.Value = Cells(Row, "H").Value
PlbegTextBox.Value = Cells(Row, "J").Value
UnibegTextBox.Value = Cells(Row, "K").Value
StartTextBox.Value = Cells(Row, "F").Value
EindTextBox.Value = Cells(Row, "G").Value
AfsprakenTextBox.Value = Cells(Row, "N").Value
Dim Findstring As String
Dim Rng As Range
Findstring = TeamTextBox.Value
If Trim(Findstring) <> "" Then
With Sheet7.Range("B5:C200")
Set Rng = .Find(What:=Findstring, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
Rng.Select
Else
Range("B1000").Find(xlEndUp).Select
End If
End With
End If
Rij = ActiveCell.Row
If Cells(Rij, 2) Is Cells.Range("B6:B55") & Not Cells(Rij, 2) Is Nothing Then
Row = ActiveCell.Row
Else:
Row = Sheet7.Cells(Rows.Count, 2).End(xlUp).Offset(1).Row
End If
KofferTextBox.Value = Cells(Row, "E").Value
Findstring = NaamTextBox.Value
If Trim(Findstring) <> "" Then
With Sheet10.Range("B5:C200")
Set Rng = .Find(What:=Findstring, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
Rng.Select
JaOptionButton.Value = True
Else
Range("B1000").Find(xlEndUp).Select
NeeOptionButton.Value = True
End If
End With
End If
Rij = ActiveCell.Row
If Cells(Rij, 2) Is Cells.Range("B6:B55") & Not Cells(Rij, 2) Is Nothing Then
Row = ActiveCell.Row
Else:
Row = Sheet10.Cells(Rows.Count, 2).End(xlUp).Offset(1).Row
End If
UnitheseTextBox.Value = Cells(Row, "D").Value
UPSBegTextBox.Value = Cells(Row, "E").Value
OndTextBox.Value = Cells(Row, "C").Value
InleidingTextBox.Value = Cells(Row, "F").Value
MethodeTextBox.Value = Cells(Row, "G").Value
ResdisTextBox.Value = Cells(Row, "H").Value
DefTextBox.Value = Cells(Row, "I").Value
BijzTextBox.Value = Cells(Row, "J").Value
Application.ScreenUpdating = True
End Sub
Als ik dan echter het Userform oproep dmv StudentUserForm.show krijg ik de runtime error 91: object or with block variable not set.
Ik zie even niet hoe dat komt.
zou iemand mij kunnen helpen?
Alvast heel erg bedankt!
Groet,
Bernice