Trying to figure out how to make the "Str" criteria have multiple options if the value in B1 is "All".
VBA Code:
Dim rngCriteria1 As Range
Dim rngCriteria2 As Range
Dim lastorw As Long
Dim LastCol As Long
Dim Str As String
With Sheet1
lastrow = .Cells(Rows.Count, "A").End(xlUp).Row
LastCol = .Cells(1, Columns.Count).End(xlToLeft).Column
End With
With Sheet6
If .Range("B1") = "All" Then
Str = "Apple, Pair, Orange"
Else: Str = .Range("B1")
End If
End With
With Sheet6
Set rngCriteria1 = Sheet1.Range("A2:M" & lastrow)
Set rngCriteria2 = Sheet1.Range("B2:M" & lastrow)
.Range("B3") = WorksheetFunction.CountIfs(rngCriteria1, "=A3", rngCriteria2, Str)
Set rngCriteria1 = Nothing
Set rngCriteria2 = Nothing
End With