qq_39943601
2021-06-22 16:02
采纳率: 100%
浏览 243

VBA子过程或函数未定义 怎么解决?


Private Sub CommandButton3_Click()
Dim myarr, mybrr()
ReDim mybrr(0)

myarr = Range("H3:L5")

Set myadic = CreatObject("scripting.dictionary")
Set mybdic = CreatObject("scripting.dictionary")
Set mycdic = CreatObject("scripting.dictionary")

For i = 1 To UBound(myarr)
If myarr(i, 1) <> "" Then myadic(myarr(i, 1)) = ""
Next i

For i = 1 To UBound(myarr)
If myarr(i, 2) <> "" And myadic.exists(myarr(i, 2)) Then
mybdic(myarr(i, 2)) = ""
End If
Next i

k = 0
For i = 1 To UBound(myarr)
If myarr(x, 3) <> "" And mybdic.exists(myarr(i, 3)) Then
k = k + 1
ReDim Preserve mybrr(k)
mybrr(k) = myarr(i, 3)
mycdic(myarr(i, 3)) = ""
End If
Next i

[V2].Resize(k + 1, 1) = Application.Transpose(mybrr)
[W2].Resize(mycdic.Count, 1) = Application.Transpose(mycdic.keys)
End Sub

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • 碰碰虎 2021-06-22 22:04
    最佳回答

    把CreatObject 改正成CreateObject。单词拼写错误

    评论
    解决 1 无用
    打赏 举报

相关推荐 更多相似问题