![]() |
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 |
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 |
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 |
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