I want to get Excel VBA to return, in a messagebox prompt, all items which are in column A of worksheet Mastersheet but are not in column A of worksheet DeliverySheet.
Having a lot of trouble figuring this one out, here's what I got so far:
Private Sub CommandButton5_Click() Dim DeliveryName As Range Dim MasterName As Range Dim MasterSheet As Worksheet Dim DeliverySheet As Worksheet Dim valueToFind Set MasterSheet = Sheets("Delivery Master List Drop") Set DeliveryName = Sheets("For Delivery").Range(Sheets("For Delivery").Cells("A:A")) Set MasterName = Sheets("Delivery Master List Drop").Range(Sheets("Delivery Master List Drop").Cells("A:A")) For i = 3 To 3000 valueToFind = DeliveryName("i,1") For Each MasterName In MasterSheet If Not MasterName.Cells = valueToFind Then MsgBox "The following name is not found in the Delivery Master List" & DeliveryName(i, 1).Value, vbExclamation End If Next MasterName Next i End Sub
I would preferably like the messagebox to return all items not found (which also don't happen to be values of ("")) in a list, which displays after macro is complete. Right now I am just trying to get it to even return one value.