'----------------------------Variablen
Dim Count As Long
'Arrays deklarieren
Dim Schadstoff() 'Array der Schdstoffkenzahl im Kundensatamm
Dim Motor() ' Kenzahl des Motortyps (Verbrennung) im Kundenstamm
Dim Pfadalle, Ergebniss
Dim Suchwert As String
Private Sub bEinstufen_Click()
'Emittelt die Schdstoff Klassifizierung
XLSEinlesen
ac = 0
For x = 1 To Count
ac = ac + 1
If Motor(ac) = "B" Then
Suchwert = Schadstoff(ac)
Benziner
Else
Diesel
Suchwert = Schadstoff(ac)
End If
Range("i" & ac).Value = Ergebniss
Next x
End Sub
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
Sub Benziner()
Pfadalle = ThisWorkbook.Path
Dim Pfadeuro(4)
Pfadeuro(0) = Pfadalle & "\Benzin_Euro1.txt"
Pfadeuro(1) = Pfadalle & "\Benzin_Euro2.txt"
Pfadeuro(2) = Pfadalle & "\Benzin_Euro3.txt"
Pfadeuro(3) = Pfadalle & "\Benzin_Euro4.txt"
For f = 0 To 3
Open Pfadeuro(f) For Input As #1
Do While Not EOF(1)
Line Input #1, sLine
If InStr(1, sLine, Suchwert, 1) > 0 Then
Ergebniss = f + 1
Exit Do
Else
End If
Loop
Ergebniss = 0
Close #1
Next f
End Sub
Sub Diesel()
End Sub