Hoi,
Ik krijg steeds de fout melding 1004
De waarde r is ook nothing wat volgens mij er op wijst dat de macro de tabel niet vind. wie kan mij helpen?
Dim rng As Excel.Range
If Plaats2.Text = "" Then Xb = Plaats.Text Else: Xb = Plaats2.Text
With Sheets("Plaatsen").Range("Tabel4[Plaats]")
Set rng = .Find(What:=Xb, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
Lookat:=xlWhole, _
Searchorder:=xlByRows, _
Searchdirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
Dim r As Range
'regel hier onder geeft de fout 1004
Set r = .Range("Tabel4[Plaats]" & .Cells(.Rows.Count, 1).End(xlUp).Row).Find(Xb, LookIn:=xlValues)
If TextBox39.Text < 75 Then TextBox40.Value = .Cells(r.Row, 2)
If TextBox39.Text >= 75 Then TextBox40.Value = .Cells(r.Row, 3)
Else: UserForm1.Show
End If
End With
On Error GoTo 0
End Sub
Ik krijg steeds de fout melding 1004
De waarde r is ook nothing wat volgens mij er op wijst dat de macro de tabel niet vind. wie kan mij helpen?
Dim rng As Excel.Range
If Plaats2.Text = "" Then Xb = Plaats.Text Else: Xb = Plaats2.Text
With Sheets("Plaatsen").Range("Tabel4[Plaats]")
Set rng = .Find(What:=Xb, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
Lookat:=xlWhole, _
Searchorder:=xlByRows, _
Searchdirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
Dim r As Range
'regel hier onder geeft de fout 1004
Set r = .Range("Tabel4[Plaats]" & .Cells(.Rows.Count, 1).End(xlUp).Row).Find(Xb, LookIn:=xlValues)
If TextBox39.Text < 75 Then TextBox40.Value = .Cells(r.Row, 2)
If TextBox39.Text >= 75 Then TextBox40.Value = .Cells(r.Row, 3)
Else: UserForm1.Show
End If
End With
On Error GoTo 0
End Sub