how can i find cells which contain certain text?

  • Thread starter Pam Deshazier, SRHS
  • Start date
P

Pam Deshazier, SRHS

example, in certain column, need to find all records which contain M.D. or MD
or M.D, etc
 
E

Elkar

You could use Conditional Formatting to highlight these cells.

Select your Column
From the Format Menu, choose "Conditional Formatting..."
Change "Cell Value Is" to "Formula Is"
Enter the formula: =FIND("MD",SUBSTITUTE(A1,".",""))
Set your format (red background perhaps?)
Click OK

That should do it.

HTH,
Elkar
 
D

Don Guillett

try this where your column is col b in sheet2
Sub findmd()
myword = Array("MD", "M.D")
For Each cel In myword
With Worksheets(2).Columns(2)
Set c = .Find(cel, LookIn:=xlValues, lookat:=xlPart)
If Not c Is Nothing Then
firstAddress = c.Address
Do
MsgBox c.Address
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
Next cel
End Sub
 
Top