Hello Guys
Please advise to use the below code to loop through the below table to get unique values (# of POs made by each buyer)
Please advise to use the below code to loop through the below table to get unique values (# of POs made by each buyer)
VBA Code:
Dim MyDict As Object, c As Variant, LR1 As Long, LR2 As Long, rng As Range
Dim i
Set MyDict = CreateObject("Scripting.Dictionary")
LR1 = Sheets("PO").Range("R65536").End(xlUp).Row
On Error Resume Next
For i = 4 To 15
For Each c In Sheets("PO").Range("B3:B" & LR1)
If c.Offset(0, -1) = Sheet19.cmbBranchB Then
If c.Offset(0, 16) = Sheets("PO Analysis").Range("J" & i) Then
If Not MyDict.exists(c.Value) Then MyDict.Add c.Value, Nothing
End If
End If
Next c
Sheets("PO Analysis").Range("J" & i).Offset(0, 1) = MyDict.Count
Next