AW: Index außerhalb des Gültigen Bereichs
23.05.2006 16:28:54
Henning
Sub vergleich()
Dim i As Integer
Dim k As Integer
Dim name As String
Dim tabellenblatt As String
name = "Kodierung1"
tabellenblatt = "Tabelle1"
pfad = ThisWorkbook.Path & "\" & name & ".xls"
Application.ScreenUpdating = False
Workbooks.Open pfad
ThisWorkbook.Activate
Application.ScreenUpdating = True
With Worksheets("Tabelle1")
For i = 3 To 23
For k = 2 To 2387
If Workbooks(name).Worksheets(tabellenblatt).Cells(i, 4) = "" Then
Workbooks(name).Worksheets(tabellenblatt).Cells(i, 5) = 69
Workbooks(name).Worksheets(tabellenblatt).Cells(i, 6) = 69
Workbooks(name).Worksheets(tabellenblatt).Cells(i, 7) = 69
Workbooks(name).Worksheets(tabellenblatt).Cells(i, 8) = 69
Exit For
Else
If Workbooks(name).Worksheets(tabellenblatt).Cells(2, 4) = .Cells(k, 4) Then
If Workbooks(name).Worksheets(tabellenblatt).Cells(i, 4) = .Cells(k, 7) Then
Workbooks(name).Worksheets(tabellenblatt).Cells(i, 5) = .Cells(k, 9)
Workbooks(name).Worksheets(tabellenblatt).Cells(i, 6) = .Cells(k, 10)
Workbooks(name).Worksheets(tabellenblatt).Cells(i, 7) = .Cells(k, 11)
Workbooks(name).Worksheets(tabellenblatt).Cells(i, 8) = .Cells(k, 12)
Exit For
End If
End If
End If
Next k
Next i
end with
End Sub