der Code funktioniert super, nur er schreibt mir nicht in die letzte freie Zeile der Spalte.
Habe es so versucht, aber funktioniert nicht und kommt fehler: End(xlUp).Row.Value
StandortBestandsliste.Sheets("Maschinen").Cells(j, 22).End(xlUp).Row.Value = ActiveWorkbook.Sheets("Maschinen").Cells(i, 22).Value
Sub DoWork()
Dim i, j As Long
Dim maxT, maxG As Long
Dim foundG As Boolean
If ListenVergleich Then
Workbooks(MyWorkBook).Activate
maxT = ActiveWorkbook.Sheets("Maschinen").Cells.SpecialCells(xlCellTypeLastCell).Row
maxG = StandortBestandsliste.Sheets("Maschinen").Cells.SpecialCells(xlCellTypeLastCell). _
Row
For i = 1 To maxT
maxG = StandortBestandsliste.Sheets("Maschinen").Cells.SpecialCells( _
xlCellTypeLastCell).Row
foundG = False
For j = 1 To maxG
If ActiveWorkbook.Sheets("Maschinen").Cells(i, 22).Value = _
StandortBestandsliste.Sheets("Maschinen").Cells(j, 22).Value Then
' we found the name
foundG = True
' Update columns anyway
StandortBestandsliste.Sheets("Maschinen").Cells(j, 23).Value = _
ActiveWorkbook.Sheets("Maschinen").Cells(i, 23).Value
'StandortBestandsliste.Sheets("Maschinen").Cells(j, 3).Value = _
ActiveWorkbook.Sheets("Maschinen").Cells(i, 3).Value
End If
Next j
If Not foundG Then
StandortBestandsliste.Sheets("Maschinen").Cells(j, 22).Value = ActiveWorkbook. _
Sheets("Maschinen").Cells(i, 22).Value
StandortBestandsliste.Sheets("Maschinen").Cells(j, 23).Value = ActiveWorkbook. _
Sheets("Maschinen").Cells(i, 23).Value
'StandortBestandsliste.Sheets("Maschinen").Cells(j, 3).Value = ActiveWorkbook. _
Sheets("Maschinen").Cells(i, 3).Value
End If
Next i
End If
End Sub