Check if value exists in column in VBA

后端 未结 6 1172
花落未央
花落未央 2020-11-28 06:08

I have a column of numbers of over 500 rows. I need to use VBA to check if variable X matches any of the values in the column.

Can someone please help me?

6条回答
  •  误落风尘
    2020-11-28 06:51

    try this:

    If Application.WorksheetFunction.CountIf(RangeToSearchIn, ValueToSearchFor) = 0 Then
    Debug.Print "none"
    End If
    

提交回复
热议问题