Sub XLSEinlesen() 'liest die eingegebenen der spalten G und H werte in variablen Count = (Cells.SpecialCells(xlLastCell).Row) 'Anzahl der Zeilen werden ermittelt ReDim Preserve Schadstoff(Count) 'schadstoff Array auf passende größe Dimensionieren ReDim Preserve Motor(Count) 'Motorarray domensionieren SC = 0 For I = 1 To Count SC = SC + 1 Schadstoff(SC) = Range("g" & SC).Value Motor(SC) = Range("h" & SC).Value ac = ac + 1 If Motor(ac) = "B" Then Suchwert = Schadstoff(ac) Benziner Else Diesel Suchwert = Schadstoff(ac) End If Next I End Sub