Im trying to check if a range of cells each have a value defined in another range
This is my current code:
Sub CheckInstallationName()
Dim LastRow As Long
With Worksheets(2)
LastRow = .Cells(.Rows.Count, Worksheets(1).Cells(4, 3).Value).End(xlUp).Row
End With
Dim rngA As Range
Set rngA = Range(Worksheets(1).Cells(4, 3).Value & "4:" & Worksheets(1).Cells(4, 3).Value & LastRow)
Dim cellA As Range
Dim InstallationNameRange As Variant
InstallationNameRange = Worksheets(1).Range("B16:B32").Value
For Each cellA In rngA
If UBound(Filter(InstallationNameRange, cellA.Value)) < 0 Then
'Some code
End If
Next cellA
End Sub
On the If UBound(filter(InstallationNameRange, cellA.Value)) < 0 Then
I get the error "Run-time error '13': Type mismatch" and cannot find a solution for this. Probably it is a very small fix. Without this if-statement the code works