objektvariable oder with-blockvariable nicht festg
15.06.2018 09:42:51
Antonio
bei diesem Code kommt ständig die Meldung:
objektvariable oder with-blockvariable nicht festgelegt
in der Fett markierte Zeile.
Private Sub ListBox5_Click()
Dim strString As String
Dim rngFind As Range
Dim i As Integer
'SpinButton1.Enabled = True
'SpinButton1.BackColor = vbGreen
TextBox2.Value = ListBox5.Value
strString = TextBox2.Value
ListBox1.Clear
Dim ws1 As Worksheet
Set ws1 = Worksheets("Skalen")
For i = 13 To 97 Step 6
With Worksheets("Skalen")
Set rngFind = Columns("B:B").Find(strString, LookAt:=xlWhole, LookIn:=xlValues, _
MatchCase:=True)
ListBox1.AddItem .Cells(rngFind.Row, i)
ListBox1.List(ListBox1.ListCount - 1, 1) = .Cells(rngFind.Row, i + 1)
ListBox1.List(ListBox1.ListCount - 1, 2) = .Cells(rngFind.Row, i + 2)
ListBox1.List(ListBox1.ListCount - 1, 3) = .Cells(rngFind.Row, i + 3)
ListBox1.List(ListBox1.ListCount - 1, 4) = .Cells(rngFind.Row, i + 4)
ListBox1.List(ListBox1.ListCount - 1, 5) = .Cells(rngFind.Row, i + 5)
End With
Next i
Dim rngZelle As Range
With Worksheets("Skalen")
Set rngZelle = .Columns(2).Find(TextBox2, LookAt:=xlWhole)
If Not rngZelle Is Nothing Then
TextBox3 = rngZelle.Offset(0, 6) & " " & rngZelle.Offset(0, 7) & " " & rngZelle. _
Offset(0, 8) & " " & rngZelle.Offset(0, 9) & " " & rngZelle.Offset(0, 10)
TextBox4 = rngZelle.Offset(0, 1) & " " & rngZelle.Offset(0, 2) & " " & rngZelle. _
Offset(0, 3) & " " & rngZelle.Offset(0, 4) & " " & rngZelle.Offset(0, 5)
End If
End With
Set rngZelle = Nothing
Set ws1 = Worksheets("Tabelle6")
ws1.Range("K16") = TextBox1.Text
ws1.Range("K17") = TextBox2.Text
End Sub
Habe schon viele Versuche unternommen und aus dem Forum viele Code für die Suche eingesetzt,ohne Erfolg.
Kann mir bitte jemand helfen den Fehler zu finden damit mein Code vollständig läuft?
Danke im Voraus
Antonio