|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub 删除()
With ActiveSheet
r = .Cells(Rows.Count, 4).End(xlUp).Row
ar = .Range("d1:f" & r)
For i = 2 To UBound(ar)
If ar(i, 3) <> "" Then
If InStr(ar(i, 3), ";") > 0 Then
rr = Split(ar(i, 3), ";")
For s = 0 To UBound(rr)
If InStr(ar(i, 1), rr(s)) > 0 Then
ar(i, 1) = Replace(ar(i, 1), rr(s) & ";", "")
End If
Next s
Else
If InStr(ar(i, 1), ar(i, 3)) > 0 Then
ar(i, 1) = Replace(ar(i, 1), ar(i, 3), "")
End If
End If
End If
Next i
.Range("d1:f" & r) = ar
End With
MsgBox "ok!"
End Sub
|
|