View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default How do I search for a word and add text to a cell if found?

Substitute actual text for Specific text and Custom text. Also, assumed the
worksheet to be 1, if not change that too.

Sub SpefcText()
Dim c As Range
myVar = "Specific Text"
Set c = Worksheets(1).Cells.Find(myVar, LookIn:=xlValues)
If Not c Is Nothing Then
Range("A" & c.Row) = "Custom Text"
End If
End Sub

"Bie1997" wrote:

How would I search each row for specific text and return custom text to the
beginning of the row the search text was found in?