0
我想計算最後有多少單元格的值不在列表中,並且反映了MsgBox中的數字。計算有多少個單元格的值不在特定列表中
下面是來自澤維爾納瓦羅代碼
Sub CheckDropDown()
Dim MyStringVar As Variant, i As Integer
Dim Lookup_Range, cel As Range, lastRow As Integer, check As Boolean
Set Lookup_Range = Worksheets("Lists").Range("C1:C21")
lastRow = ActiveSheet.Cells(ActiveSheet.Rows.Count, "A").End(xlUp).Row
For i = 2 To lastRow
For Each cel In Lookup_Range
If ActiveSheet.Cells(i, 25) = cel.Value Then
check = True: Exit For
Else
check = False
End If
Next
If check Then
'The cell is on the lookupRange
Else
'The cell is NOT on the lookupRange
ActiveSheet.Cells(i, 25).Interior.Color = RGB(255, 255, 5)
End If
Next i
End Sub
那麼,什麼是你的問題? –