Hi,
I have a list of Customer and Items they have ordered.
I have this code that counts how many orders have been placed for 2 specific items (TBA and 8IM) and places the value in worksheet List cell A1:
Sub CountItems()
Dim wsd As Worksheet, wsc As Worksheet
Dim Lastrow As Long, i As Long, J As Long
Dim Cell As Range
Set wsc = Sheets("List")
Set wsd = Sheets("Jan")
i = 0
Application.ScreenUpdating = False
With wsd
Lastrow = .Range("B" & Rows.Count).End(xlUp).Row
For Each Cell In .Range("B2:B" & Lastrow)
If Cell = "TBA" Or Cell = "8IM" Then
i = i + 1
End If
Next Cell
End With
With wsc
.Range("A1").Value = i
End With
Application.ScreenUpdating = True
End Sub
I would need some suggestions how to amend this code to count how many Customers have ordered either item TBA or item 8IM. If a Customer ordered at least once any of these items it has to be counted as 1.
Thanks,
Eduard
Bookmarks