vba - Excel VBA列表框多选填充其他列表框 - 多页的VBA代码给出错误
问题描述
我正在使用此处的视频教程创建一个 Excel VBA 列表框多选来填充其他列表框:
https://www.youtube.com/watch?v=dWTEUWqlQAc
基本上,这意味着,“Excel,如果我从 ListBox 1 中选择这些项目,从 Excel Column C 获取一系列值,则返回我在同一行的 Excel Column A 的值列表”
但是,我不断收到错误消息“编译错误无效使用属性”
这在此处突出显示了此代码:
Private Sub ListBox1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
我不确定我做错了什么。是因为我正在使用多页或带有此代码的东西吗?
我曾尝试重新观看该该死的教程,但似乎没有任何效果。
Private Sub ListBox1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
'find lastrow
lastrow = ThisWorkbook.Worksheets("List of Emails").Cells(Rows.Count, 1).End(xlUp).Row
'clear listbox1
Me.ListBox2.Value
'not just one value, but whichever were selected
For SelItm = LBound(Me.ListBox1.Email) To UBound(Me.ListBox1.Email)
If Me.ListBox1.Selected(SelItm) = True Then
'It is selected
curVal = Me.ListBox1.List(SelItm, 0)
For X = 2 To lastrow
If emails.Cells(X, "c") = curVal Then
'found a match; populate listbox2
Me.ListBox2.AddItem ThisWorkbook.Worksheets("List of Emails").Cells(X, "a")
End If
Next X
End If
Next SelItm
End Sub
无论我多么努力,我都无法摆脱错误消息。像 wtf 是“编译错误无效使用属性”?我完全按照 Youtube 指南所做的。
感谢是否有人可以提供任何形式的帮助。谢谢!
解决方案
推荐阅读
- xcode - iTunes Store 操作失败。下载的软件组件已损坏,将无法使用
- javascript - 如何使用局部变量更改全局变量
- mysql - 如何提取分隔符前后的字符串并存储在mysql中?
- python - tf.placeholder_with_default 反向传播
- algolia - 计算 algolia 查询中过滤器子集的平均分数
- firebase - FCM 主题或设备组的 Firebase 最佳做法
- android - Firebase 应用索引后不显示应用徽标
- ios - 添加一个动作以快速向后滑动 4
- java - java.policy 授予 SocketPermission 时,为什么 ServerSocket.accept() 上出现 AccessControlException?
- opengl - 无法渲染到多个立方体贴图