View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default String in a range


Hi Dan,

Try something like:

'=============
Public Sub Tester()
Dim SH As Worksheet
Dim Rng As Range
Dim Rng2 As Range
Const sStr As String = "ABC"

Set SH = ActiveSheet

With SH
Set Rng = .Range("A1")
Set Rng2 = .Range("A1:A10")
End With

MsgBox InStr(1, Rng.Value, sStr, vbTextCompare) 0
MsgBox Application.CountIf(Rng2, sStr) 0

End Sub
'<<=============


---
Regards,
Norman


"Dan" wrote in message
...
What is the Syntax to check if a string is in a range?
Thanks Dan