Hello and thank you for any attention this post may receive.
I have two columns of data on separate ws in the same wb. I would like to compare ws2 to ws1, identify and append unique values from ws1 to ws2.
Compare ws2 colA to ws1 colM and identify unique values in ws1 colM. Then append an array containing the unique values, colM and colT to the next blank cell of ws2 colA (A,B).
This is the code I have copied from another workbook which is returning 'Error 438 Object doesn't support this property or method' for line in red text in below code.
Thank you again!
I have two columns of data on separate ws in the same wb. I would like to compare ws2 to ws1, identify and append unique values from ws1 to ws2.
Compare ws2 colA to ws1 colM and identify unique values in ws1 colM. Then append an array containing the unique values, colM and colT to the next blank cell of ws2 colA (A,B).
This is the code I have copied from another workbook which is returning 'Error 438 Object doesn't support this property or method' for line in red text in below code.
Code:
Sub Append_Projects()
Dim fn As String, a
Dim i As Long, e, dic As Object
' fn = Application.GetOpenFilename("ExcelWorkbook,*.xls*")
Application.ScreenUpdating = False
Set dic = CreateObject("Scripting.Dictionary")
dic.CompareMode = 1
a = Sheets("Tables").Cells(1).CurrentRegion.Value
For i = 2 To UBound(a, 1)
dic(a(i, 1)) = Empty
Next
' With Workbooks.Open(fn)
With Sheets("Data")
.Unprotect Password:="BEx101"
.Cells(1).CurrentRegion
[COLOR=#FF0000]a = Application.Index(.Value, Evaluate("row(1:" & _
.Rows.Count & ")"), Array(13, 20))[/COLOR]
Sheets("Data").Protect Password:="BEx101"
' .Close False
End With
For i = 2 To UBound(a, 1)
If (a(i, 1) <> "") * (Not dic.exists(a(i, 1))) Then
dic(a(i, 1)) = Array(a(i, 1), a(i, 2))
End If
Next
For Each e In dic
If IsEmpty(dic(e)) Then dic.Remove e
Next
MsgBox "All new projects have been appended."
If dic.Count Then
Sheets("Tables").Range("a" & Rows.Count).End(xlUp)(2) _
.Resize(dic.Count, 2).Value = Application.Index(dic.items, 0, 0)
Else
MsgBox "No new projects to append"
End If
Application.ScreenUpdating = True
End Sub
Thank you again!