如果我遇到错误,我正在尝试编写VBA代码。
我希望代码检查是否其中一个值(“ S925,S936,S926,G”)不在单元格10上。
Sub checklist()
Dim x
Dim LineType
NumRows = Cells(Rows.Count, "j").End(xlUp).Row
For x = 2 To NumRows
If LineType = "G" Then
If Not InStr("S925,S936,S926,G", cellsCells(x, 10).Value) Then
cells Cells(x, 52).Interior.Color = rgbCrimson
cells Cells(x, 52).Value = "G"
End If
End If
End If
Next x
End Sub
Run Code Online (Sandbox Code Playgroud)