Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub HighlightHysterectomyInColumn()
- Dim ws As Worksheet
- Dim rng As Range
- Dim cell As Range
- Dim targetColumn As Range
- Dim searchText As String
- ' Specify the column where you want to search for "hysterectomy"
- Set ws = ThisWorkbook.Worksheets("Sheet1") ' Change "Sheet1" to your sheet name
- Set targetColumn = ws.Range("A:A") ' Change "A:A" to your target column
- searchText = "hysterectomy"
- ' Loop through each cell in the specified column
- For Each cell In targetColumn
- ' Check if the cell contains the word "hysterectomy"
- If InStr(1, cell.Value, searchText, vbTextCompare) > 0 Then
- ' Highlight the cell
- cell.Interior.Color = RGB(255, 0, 0) ' Highlight color: Red
- End If
- Next cell
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement