ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro to intsert a word using the "Find" command to search for a word (https://www.excelbanter.com/excel-programming/378385-macro-intsert-word-using-find-command-search-word.html)

Stuart[_3_]

macro to intsert a word using the "Find" command to search for a word
 
Just the same as the subject.

Need a macro to lookdown column A and find a word or two words hence I
think I need the Find command within the macro.

Hope someone can help

cheers

Stuart


JLGWhiz

macro to intsert a word using the "Find" command to search for a w
 
Substitute the word you want to find in place of YourWord and add the command
to do what you want to do where it says 'Do something with the word, if the
word is found.

With Worksheets(1).Columns("A")
Set c = .Find(YourWord, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
'Do something with the word
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With


"Stuart" wrote:

Just the same as the subject.

Need a macro to lookdown column A and find a word or two words hence I
think I need the Find command within the macro.

Hope someone can help

cheers

Stuart




All times are GMT +1. The time now is 10:57 AM.

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