Trying to find string in a column or row

  • Thread starter Thread starter strataguru
  • Start date Start date
S

strataguru

Hi,

Currently I have code that functions properly - but I'm sure there ha
to be a better way of coding! :-)

Basically - whenever I search for a string in a column or row - righ
now - I use a For Loop until rng.Rows.Count or rng.Columns.Count - an
then inside my loop I query to see if a cell contains the cell valu
I'm looking for..... for example

For i = 1 to rng.Rows.Count
If ws.Cells(i, 1).Value = "xyz" Then
MsgBox("Found string")
End If
Next i

Is there better way to code this ? - where I can say something like:

If rng.Rows.Contains("xyz") Then
MsgBox("Found string")
End If

Thanks in advance!
-Robi
 
Back
Top