vba-在特定列中查询目标字符串是否存在
Private Sub SearchByTaget() If ConfigSht.Range("A:A").Find(What:="1232", LookAt:=xlWhole) Is Nothing Then MsgBox "不存在" End If End Sub
Function SearchByTarget(ByVal range as Range, ByVal target as String) as Boolean
If range.Find(What:=target, LookAt:=xlWhole) Is Nothing Then
SearchByTarget = false
else
SearchByTarget = true
End If
End Sub
优化下,这个可以把一列存进字典