I'm a first time contributor to this forum so thanks for letting me join the ranks.
I've got a sub that's evaluating each cell in the range "StoreNames" to see if it is in an adjacent list. If it is not in the list the cell value is added to the MissingStores variable and the counter is increased by one.
Everything works fine except for the "Store" variable in the OR function is giving me a "type mismatch" error. I can see the variable is set correctly (the first store is listed as "American Fork") yet the runtime error breaks the code.
Any advice?
Sub CheckSubmissions()
Dim Store As Range, MissingStores As String, CountMissingStores As Integer
For Each Store In Range("StoreNames")
If Evaluate("=OR(" & Store & " = $J$2:$J$50)") = False Then
MissingStores = MissingStores & Store & ", "
CountMissingStores = CountMissingStores + 1
End If
Next Store
MsgBox "There are " & CountMissingStores & " missing from the directory path. They are " _
& MissingStores
End Sub
I've got a sub that's evaluating each cell in the range "StoreNames" to see if it is in an adjacent list. If it is not in the list the cell value is added to the MissingStores variable and the counter is increased by one.
Everything works fine except for the "Store" variable in the OR function is giving me a "type mismatch" error. I can see the variable is set correctly (the first store is listed as "American Fork") yet the runtime error breaks the code.
Any advice?
Sub CheckSubmissions()
Dim Store As Range, MissingStores As String, CountMissingStores As Integer
For Each Store In Range("StoreNames")
If Evaluate("=OR(" & Store & " = $J$2:$J$50)") = False Then
MissingStores = MissingStores & Store & ", "
CountMissingStores = CountMissingStores + 1
End If
Next Store
MsgBox "There are " & CountMissingStores & " missing from the directory path. They are " _
& MissingStores
End Sub