我有下面的代码,如果条件匹配,它会用服务填充偏移单元格。然而在这个阶段,它的操作基础是如果字符串出现在单元格中,它将应用值而不是单词是一个完整的单词。例如,我的标准中有“访问”,而“访问者”(在单元格内)将在我的代码中不应该遵守时。请问有人可以帮忙吗?
Option Compare Text
Sub CHECK_CELL_VALUES()
Dim LASTROW As Long
Application.ScreenUpdating = False
With Sheet1
LASTROW = .Range("A1048576").End(xlUp).Row
For i = 2 To LASTROW
If Cells(i, 7).Value Like "*Service*" _
Or Cells(i, 7).Value Like "*Servicing*" _
Or Cells(i, 7).Value Like "* Labour*" _
Or Cells(i, 7).Value Like "* Job*" _
Or Cells(i, 7).Value Like "* Hire*" _
Or Cells(i, 7).Value Like "* Visit*" _
Or Cells(i, 7).Value Like "* Scaffold*" _
Or Cells(i, 7).Value Like "* Contract*" _
Or Cells(i, 7).Value Like "* Hour*" _
Or Cells(i, 7).Value Like "* Month*" _
Or Cells(i, 7).Value Like "* Quarter*" _
Or Cells(i, 7).Value Like "* Day*" _
Or Cells(i, 7).Value Like "* Maintenance*" _
Or Cells(i, 7).Value Like "* Repair*" _
Or Cells(i, 7).Value Like "* Survey*" _
Or Cells(i, 7).Value Like "* Training*" _
Or Cells(i, 7).Value Like "* Calibration*" _
Then Cells(i, 7).Offset(0, 46).Value = "Service"
Debug.Print Cells(i, 7).Address
Next i
End With
Application.ScreenUpdating = True
End Sub