Hi all,
I need to merge three 2D arrays into one. I have arry1, 2 and 3 which come from three different sheets, they are all of the same size. Now I want to create a consolidated array with all unique Materials of the three arrays and if the Material is not unique I want to replace all data points that contain " - " with whatever the matched array contains (either " x " or " - " as well).
I created a simplified sample workbook to illustrate things further with a "desired output" sheet to show how the end result should look like. Below is the code I have so far to combine at least 2 of these arrays, however, that also doesn't seem quite right yet as some Materials are overwritten or neglected. 
Dim Concat()
Dim size As Long
ReDim Concat(1 To UBound(arry1, 1), 1 To UBound(arry1, 2))
For i = LBound(arry1, 1) To UBound(arry1, 1)
On Error Resume Next
Dim MtchRw As Long
MtchRw = Application.Match(arry1(i, 1), Application.Index(arry2, , 1), 0)
If Err.Number <> 0 Then MtchRw = 0
Err.Clear
On Error GoTo 0
size = size + 1
For j = LBound(arry1, 2) To UBound(arry1, 2)
If MtchRw <> 0 Then
Dim Cont As Variant
Cont = arry2(MtchRw, j)
If Cont = " - " Then
Concat(size, j) = arry1(i, j)
Else
Concat(size, j) = arry2(MtchRw, j)
End If
Else
Concat(size, j) = arry1(i, j)
End If
Next j
Next i
Bookmarks