
下面的代码错在那,大神帮忙修改下,不胜感激。
判断I2到M2非空单元格与B到F列有重复,只要有一个重复出现提示,全无重复将导过去。
Sub 客户编码新建()
'
' Macro2 Macro
'
'
Dim li%
If Range("i2") = [""] Then
ElseIf [b:f].Find([i2]) = [i2] Then
Range("i3") = "重复"
Else
End If
If Range("j2") = [""] Then
ElseIf [b:f].Find([j2]) = [j2] Then
Range("j3") = "重复"
Else
End If
If [b:f].Find([m2]) = [""] Then
ElseIf [b:f].Find([m2]) = [m2] Then
Range("m3") = "重复"
Else
End If
If [b:f].Find([l2]) = [""] Then
ElseIf [b:f].Find([l2]) = [l2] Then
Range("l3") = "重复"
Else
End If
If [b:f].Find([k2]) = [""] Then
ElseIf [b:f].Find([k2]) = [k2] Then
Range("k3") = "重复"
Else
End If
If Range("i3") = "重复" Or Range("j3") = "重复" Then GoTo 100
li = Application.CountA([d:d]) + 1
Range("I2:M2").Select
Selection.Copy
Range("b" & li).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("I2:M2").Select
Application.CutCopyMode = False
Selection.ClearContents
100:
MsgBox "有重复数无法保存数据"
End Sub