用您原來的修改如下,謝謝
另外建議,資料多時可以將資料裝到數組,這樣效率比較快
Sub BBB()
keyword = "AW"
keyword2 = "BW1"
For i = 7 To 26
If Cells(i, 1) Like "*" & keyword & "*" Or Cells(i, 1) Like "*" & keyword2 & "*" Then
Cells(i, 3) = ""
Cells(i, 4) = ""
Cells(i, 5) = ""
Cells(i, 6) = ""
End If
Next
End Sub作者: samwang 時間: 2022-7-25 11:13
用數組方式,請測試看看,謝謝
Sub test()
Dim Arr, T$, i&, j%
Arr = Range([f7], [a65536].End(3))
For i = 1 To UBound(Arr)
T = Arr(i, 1)
If InStr(T, "AW") Or InStr(T, "BW1") Then
For j = 3 To 6: Arr(i, j) = "": Next
End If
Next
Range("a7").Resize(UBound(Arr), 6) = Arr
End Sub作者: Andy2483 時間: 2022-7-26 12:33