ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Finding specific word in column (https://www.excelbanter.com/excel-worksheet-functions/19405-finding-specific-word-column.html)

Phil #3

Finding specific word in column
 
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




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


"Phil #3" wrote in message
et...
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






Phil #3

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

"Trevor Shuttleworth" wrote in message
...
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


"Phil #3" wrote in message
et...
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








Trevor Shuttleworth

You're welcome. Thanks for the feedback.


"Phil #3" wrote in message
ink.net...
This is exactly what I was looking for. It works perfectly.
Thanks. You guys are genius' :)
Phil

"Trevor Shuttleworth" wrote in message
...
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


"Phil #3" wrote in message
et...
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











All times are GMT +1. The time now is 04:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com