I am new to writing in excel and coding in general. I wrote this to check if a corresponding cell was blank and if it wasn't, to loop through the array. If any of the array is present in the cell, then the target cell value will be "Y".
It gets through one row then stalls. I isolated the issue to be the for
loop but I cannot figure out what is causing it to crash Excel. Any help is greatly appreciated.
Sub test()
Dim LR As Long, i As Long, j As Long, aNames
aNames = Array("this", "that", "the other")
Cells(2, 21).Activate
Do While Not IsEmpty(ActiveCell.Offset(, -15))
For j = LBound(aNames) To UBound(aNames)
On Error Resume Next
If ActiveCell.Offset(, -15).Value Like "*" & aNames(j) & "*" Then
ActiveCell.Value = "Y"
ActiveCell.Offset(1, 0).Activate
On Error GoTo Last
Else
End If
Next j
Loop
Last:
End Sub