0

Could someone help me with my code. I would like to scan each cell in range J24:J56 for AVI, even if the cell contains multiple strings. And then I would like it to output BULK HOLD 5 in the cell next to it and change color. My code is working but if the cell contains additional strings for example "AVI PER SPX" it won't output anything in the cell next to it. Is there a simple way to fix this?

My code:

Dim myRange As range
Dim Mycell As range

Set myRange = range("J24:J56")
For Each Mycell In myRange
    If Mycell Like "AVI" Then
        Mycell.Offset(0, 1).Interior.Color = RGB(255, 255, 0)
        Mycell.Offset(0, 1).Value = ("BULK HOLD 5")
    End If
Next Mycell
BigBen
  • 38,994
  • 6
  • 24
  • 37
  • `If Mycell Like "*AVI*" Then`: use wildcards. Or use `InStr` as also demonstrated in the linked thread. – BigBen May 25 '22 at 14:26

0 Answers0