excel中b列已有若干不同数据,我在a列输入b列中任一数据,b列中数据自动删除,保留a列数据
展开全部
vba表格change事件
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then
If Target.Count = 1 Then
If Len(Target) > 0 Then
Set rng = Columns(2).Find(Target, lookat:=xlWhole)
If Not rng Is Nothing Then
Application.EnableEvents = False
rng.Value = ""
For j = rng.Row + 1 To Cells(Rows.Count, 2).End(3).Row
If Cells(j, 2) = Target Then
Cells(j, 2) = ""
End If
Next j
Application.EnableEvents = True
End If
End If
End If
End If
End Sub
刚才有个帖子一样的
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询