M
mlthornton
I am attempting to use the following code to:
loop through a range of cells and check each cell to see if its value exists in an array in a different sheet. The function tells how many matches were found.
Function ShiftTCC(Week As Range)
Set ProductRange = Sheets(Week.Value).Range("B1:B50")
Set ProductArray = Sheets("Classes").Range("A3:A15")
If Not ProductRange Is Nothing Then
For Each ProductCell In ProductRange
MsgBox ProductCell.Value
m = WorksheetFunction.Match(ProductCell.Value, ProductArray, 0)
if m > 0 then
totalcount = totalcount + 1
end if
Next
ShiftTCC = totalcount
End If
End Function
loop through a range of cells and check each cell to see if its value exists in an array in a different sheet. The function tells how many matches were found.
Function ShiftTCC(Week As Range)
Set ProductRange = Sheets(Week.Value).Range("B1:B50")
Set ProductArray = Sheets("Classes").Range("A3:A15")
If Not ProductRange Is Nothing Then
For Each ProductCell In ProductRange
MsgBox ProductCell.Value
m = WorksheetFunction.Match(ProductCell.Value, ProductArray, 0)
if m > 0 then
totalcount = totalcount + 1
end if
Next
ShiftTCC = totalcount
End If
End Function