Sub TEST()
Dim arr, i&, j&, Rng As Range, strTxt$, iStart&
Set Rng = Selection
If Rng.Count > 1 Then MsgBox "请选择单个单元格!": Exit Sub
If Split(Rng.Address(, 0), "$")(0) <> "D" Then MsgBox "请选择D列!": Exit Sub
If InStr(Rng, "●") Then
strTxt = Mid(Rng, InStr(Rng, "●"))
arr = Range([D1], Cells(Rows.Count, "D"))
iStart = Val(Split(Rng.Address(, 0), "$")(1))
For i = iStart To UBound(arr)
If InStr(arr(i, 1), "●") Then
If "●" & Split(arr(i, 1), "●")(1) = strTxt Then
If Cells(i, "D").Offset(, 5) = "" Then Cells(i, "D").Offset(, 5) = strTxt
End If
End If
Next i
End If
End Sub |