|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
大神们字典函数,使用数字作为关键字,一运行会出现字类型不匹配,如图
代码标黄的会报错“字类型不匹配”,请大神帮忙检查哈
Sub sji()
Dim d, n, arr, brr
Set d = CreateObject("Scripting.Dictionary")
n = Sheet2.Cells(Rows.Count, 6).End(xlUp).Row
arr = Sheet2.Range("F2:F" & n)
For i = 1 To n - 1
d(arr(i, 1)) = ""
Next
s = Sheet1.Cells(Rows.Count, 1).End(xlUp).Row
brr = Sheet1.Range("A2:A" & s)
For i = 1 To s - 1
If d.exists(brr(i, 1)) Then
Sheet1.Cells(i + 1, 2) = "YES"
Else
Sheet1.Cells(i + 1, 2) = "NO"
End If
Next
End Sub
|
-
关键字类型不匹配
-
-
调试.rar
16.92 KB, 下载次数: 14
|