Finding specific word in column

P

Phil #3

I need to add the following to my present macro if possible.
In column Q, which often contains a sentence or two of text, sometimes
nothing, I need to add the function to find the word "waived", if present,
from among the words in each cell and place a "W" into column N on the same
row and if not present, put nothing then continue the macro.
(XL2000, column currently formatted as "General").
Phil
 
T

Trevor Shuttleworth

Phil

one way, mostly from the VBA Help:

Sub FindWaivedInQ()
Dim c As Range
Dim FirstAddress As String
With Range("Q1:Q" & Range("Q" & Rows.Count).End(xlUp).Row)
Set c = .Find("waived", LookIn:=xlValues)
If Not c Is Nothing Then
FirstAddress = c.Address
Do
c.Offset(0, -3).Value = "W"
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> FirstAddress
End If
End With
End Sub

Regards

Trevor
 
P

Phil #3

This is exactly what I was looking for. It works perfectly.
Thanks. You guys are genius' :)
Phil
 
T

Trevor Shuttleworth

You're welcome. Thanks for the feedback.


Phil #3 said:
This is exactly what I was looking for. It works perfectly.
Thanks. You guys are genius' :)
Phil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top