DeWaal Le Grange
Board Regular
- Joined
- Jun 17, 2009
- Messages
- 99
Hi there Excel experts
i need a vba code that will highlight all cells containing this word (discontinued) but it can be anything from "disco" upwords eg. "disco","discon",discont",disconti",discontin" and so on...
My range of data starts from Cells "B37:B65536" when anyone of the aboved mention is found it must be highlighted "Green" it must also highlite the cell before it in column A and the cell after it in column C.
eg.
Column A /ColumnB /Column C
green / silicone discont /green
the vba i have looks like this but doesnt do what it is uppose to.
Sub highlight()
Dim cell As Range
Range(Range("a37:c65536"), Range("a37:c65536").End(xlDown)).Select
For Each cell In Selection
If cell = "disc" Then cell.Cells.Interior.ColorIndex = 4
Next cell
End Sub
Please help me out on this...
Thanks Dewaal
i need a vba code that will highlight all cells containing this word (discontinued) but it can be anything from "disco" upwords eg. "disco","discon",discont",disconti",discontin" and so on...
My range of data starts from Cells "B37:B65536" when anyone of the aboved mention is found it must be highlighted "Green" it must also highlite the cell before it in column A and the cell after it in column C.
eg.
Column A /ColumnB /Column C
green / silicone discont /green
the vba i have looks like this but doesnt do what it is uppose to.
Sub highlight()
Dim cell As Range
Range(Range("a37:c65536"), Range("a37:c65536").End(xlDown)).Select
For Each cell In Selection
If cell = "disc" Then cell.Cells.Interior.ColorIndex = 4
Next cell
End Sub
Please help me out on this...
Thanks Dewaal
Last edited: