excel - 双击会出现错误数据
问题描述
为什么我双击列表框时,数据会出来前一个?有时,它只是从列表框中出来的随机数据。
仅供参考,它将发生在“要收集的金额(Emp 4)”,“Acct. Mgr(Emp 5)”,“电话(Emp 6)”和“电子邮件(Emp 7)”上。
这是图像,以便您可以看得更清楚。
Private Sub lstEmployee_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
'dim the variables
Dim i As Integer
On Error Resume Next
'find the selected list item
i = Me.lstEmployee.ListIndex
Dim methodsOfCommunication() As String
Me.Emp1.Value = Me.lstEmployee.Column(0, i)
Select Case Me.lstEmployee.Column(2, i)
Case "Yes"
Me.Emp2.Value = True
Me.Emp3.Value = False
Case "No"
Me.Emp2.Value = False
Me.Emp3.Value = True
End Select
' Reset Methods of Communication checkboxes.
Me.Emp8.Value = False
Me.Emp9.Value = False
Me.Emp10.Value = False
Me.Emp11.Value = False
Me.Emp12.Value = False
' Set Methods of Communication checkboxes.
methodsOfCommunication = Split(Me.lstEmployee.Column(1, i), ", ")
For i = LBound(methodsOfCommunication, 1) To UBound(methodsOfCommunication, 1)
Select Case methodsOfCommunication(i)
Case "Whatsapp"
Me.Emp8.Value = True
Case "Phone Call"
Me.Emp9.Value = True
Case "Facebook"
Me.Emp10.Value = True
Case "Email"
Me.Emp11.Value = True
Case "SMS"
Me.Emp12.Value = True
End Select
Next
Me.Emp4.Value = Me.lstEmployee.Column(3, i)
Me.Emp5.Value = Me.lstEmployee.Column(4, i)
Me.Emp6.Value = Me.lstEmployee.Column(5, i)
Me.Emp7.Value = Me.lstEmployee.Column(6, i)
Me.Emp13.Value = Me.lstEmployee.Column(7, i)
Me.Emp14.Value = Me.lstEmployee.Column(8, i)
Me.Emp15.Value = Me.lstEmployee.Column(9, i)
On Error GoTo 0
End Sub
解决方案
推荐阅读
- php - 使用 php 将谷歌分析数据传输到 mysqli 数据库
- python-3.x - conda 的 activate.bat 给出“系统找不到指定的路径”
- c++ - 通过类成员访问运算符访问作用域枚举器
- react-native - 即使延迟后反应本机更新setState也不会发生
- javascript - 变量不会改变值javascript
- aframe - 如何关闭 A 帧相机遮挡剔除?
- .net - .NET 中的 Parallel.ForEach 和有条件的正常循环
- angular - Ngrx/data 中不同 MergeStratagy 的真正区别是什么?
- button - 在 power bi 上创建一个带有“加载更多”的按钮
- gem5 - 如何在系统调用仿真中将命令行参数参数分配给 gem5 运行的程序?