Kompilierungsfehler unter Excel 2000
10.06.2008 14:16:00
Xelleron(Dennis)
habe eine Suchfunktion zusammengestellt (Code teilweise übernommen), die Ergebnisse sollen dann _ in einer Listbox aufgelistet werden. Unter Office 2003 und Excel 2002 läuft das Ding einwandfrei, nur unter Excel 2000 kommt Kompilierungsfehler und
Private Sub CommandButton1_Click wird gelb eingefärbt. Warum?
Hier mal der Code:
Private Sub CommandButton1_Click() ' Suchen
Columns("D:D").Select
Range("B1:M20").Sort Key1:=Range("D1"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Cells(1, 1).Select
Dim rng As Range
Dim strFirst As String
Dim vtmp() As Long
Dim tntC As Integer
If Len(Trim(input1)) = 0 Then Exit Sub
ListBox1.Clear
For IntC = 1 To 12
Controls("TextBox" & IntC) = ""
Next
ReDim vtmp(0)
With Sheets("Firmen")
Set rng = .Range("A:N").Find(What:=input1.Text, LookAt:=xlPart)
If Not rng Is Nothing Then
strFirst = rng.Address
Do
If Not (IsNumeric(Application.Match(rng.Row, vtmp, 0))) Then
ReDim Preserve vtmp(UBound(vtmp) + 1)
vtmp(UBound(vtmp)) = rng.Row
ListBox1.AddItem .Cells(rng.Row, 2)
ListBox1.List(ListBox1.ListCount - 1, 1) = .Cells(rng.Row, 3)
ListBox1.List(ListBox1.ListCount - 1, 2) = .Cells(rng.Row, 4)
ListBox1.List(ListBox1.ListCount - 1, 3) = .Cells(rng.Row, 5)
ListBox1.List(ListBox1.ListCount - 1, 4) = rng.Row
End If
Set rng = .Range("A:N").FindNext(rng)
Loop While Not rng Is Nothing And rng.Address strFirst
End If
End With
If ListBox1.ListCount > 0 Then
ListBox1.ListIndex = 0
Else
ListBox1.AddItem "Kein Eintrag!"
End If
Set rng = Nothing
End Sub