ein Ansatz mit Hashes
Christian
Hallo Peter,
hier ein Ansatz mit Hashes - in VB heißt das wohl Dictionary - allgemein assoziatives Array.
Das ganze lässt sich bestimmt noch weiter beschleunigen - ist ja nur ein Ansatz.
Auf meiner alten Leierbüchse braucht dein "Vorhandensein_I" ca. 59 Sek., derHash-Ansatz nur 9 Sek.
Gruß
Christian
Option Explicit
Sub testit()
Dim wks As Worksheet
Dim i&, j&, k&, m&, p&, lngLR&, lngLC&, strTxt$
Dim hshSrc As Object, hshComp As Object
Set hshSrc = CreateObject("Scripting.Dictionary")
Set hshComp = CreateObject("Scripting.Dictionary")
Set wks = ThisWorkbook.Worksheets("Vorhandene")
Application.ScreenUpdating = False
wks.Cells.ClearContents
With ThisWorkbook.Worksheets("allezu")
lngLR = .Cells(.Rows.Count, 1).End(xlUp).Row
For i = 1 To lngLR - 1
hshSrc.RemoveAll
For j = 1 To .Cells(i, .Columns.Count).End(xlToLeft).Column
strTxt = .Cells(i, j).Text
hshSrc(strTxt) = strTxt
Next
For k = i + 1 To lngLR
hshComp.RemoveAll
For p = 1 To .Cells(k, .Columns.Count).End(xlToLeft).Column
strTxt = .Cells(k, p).Text
If hshSrc.exists(strTxt) Then
hshComp(strTxt) = strTxt
End If
Next
m = m + 1
wks.Cells(m, 1) = i & "|" & k
wks.Cells(m, 2).Resize(, hshComp.Count) = hshComp.Items
Next
Next
End With
Application.ScreenUpdating = True
End Sub