如果发现内容,则需要过滤C列以搜索“ sim”之类的文本内容,然后填充B列的单元格
Dim lastRow ,xl
With wb
objSheet.Range("P1").Autofilter 16, Criteria1 ="=*sim*"
LastRow = objSheet.usedrange.rows.count
If lastRow > 2 Then
' objSheet.Range(objSheet.Range("O2"), objSheet.Range("O" & lastRow)). _
'SpecialCells(xlCellTypeVisible).Value = "SIMEX"
objSheet.Range("O" & LastRow).Value = "SIMEX"
End If
WScript.Echo vbCrLf _
& "LastRow:-" _
'.Range("P:P").AutoFilter Field:=16 'clear the filter
End With
实际结果如下:
Col1 Col2 Col3
asd sim sim
dfg P2P sim
fgh sim sim