运行错误“13”,类型不匹配??
大家好:
如果想要从一列有空格的名单中(假设b列)筛选出重复的名单,并将其放入另外一列中(假设m列),我编写了一段程序,可老出现运行错误“13”,类型不匹配,恳请各位帮忙解决下!不甚感激!
Sub jszq()
Dim myrow1 As Integer
Dim x As Integer, y As Integer, n As Integer
Dim AA, BB, CC
n = 1
Cells(1, 13) = 0
Range("b1").Select
myrow1 = [b65536].End(xlUp).Row
For y = 2 To myrow1
BB = 0
CC = 0
AA = 0
AA = Cells(y, 2)
BB = Application.WorksheetFunction.Search(AA, Range("b2:b" & y - 1)) '看现在的单元格是否在前几行出现过
CC = Application.WorksheetFunction.Search(AA, Range("m1:m" & n)) '看现在的单元格是否已被列入M列
If AA = "" Or CC > 0 Then '若出现无名单的单元格或者已被列入名单的名单,跳过
GoTo 100
ElseIf BB > 0 Then
Cells(n, 13) = Cells(y, 2) '否则若在前几行出现过写入M列
n = n + 1
Else
End If
100: Next y
End Sub