Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I search for a word and add text to a cell if found?

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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
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?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
search a row for a word and if found Vibeke Excel Worksheet Functions 2 April 16th 10 10:09 AM
Replace object causes an error if search text not found Scott Excel Programming 1 June 26th 06 08:13 PM
Return text found in a search Dave R. Excel Worksheet Functions 4 May 12th 05 08:53 PM
Search column - return row found in long text string JayL Excel Programming 1 March 5th 05 03:23 AM
Search for the word "continued", if found, delete that row + 10 rows above jriendeau5 Excel Programming 1 November 5th 04 02:24 AM


All times are GMT +1. The time now is 02:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"