![]()
Sub CheckLowSodium() ' ' Keyboard Shortcut: Option+Cmd+z ' ' This program looks through each cell in the Range (AT2:EP200) , and finds ' out if it has the word salt, and if so highlights column M Dim rngSearch As Range Dim vList As Variant, vWord As Variant Dim Found As Range, FirstFound As String Dim Counter As Long Set rngSearch = Range("AT2:EP200") 'Search range vList = Array("Salt") 'One word list 'vList = Array("Salt", "Pepper", "Cumin", "Oregano") 'Example list of search words For Each vWord In vList 'Loop through each search word in list Set Found = Nothing 'Find first occurrence of word Set Found = rngSearch.Find(What:=vWord, _ LookIn:=xlValues, _ LookAt:=xlPart, _ MatchCase:=False) If Not Found Is Nothing Then 'If a match was found... FirstFound = Found.Address 'Store address of first occurrence to stop loop Do Range("M" & Found.Row).Value = "x" 'Tag column M with x Counter = Counter + 1 'Count found words Set Found = rngSearch.FindNext(After:=Found) 'Find next occurrence Loop Until Found.Address = FirstFound 'Loop until the next found occurrence is the first occurrence End If Next vWord ' next word in list 'Display message MsgBox Counter & " words found and tagged in column M. ", , "Rows Tagged Commplete" End Sub
Bookmarks