在不同的组合框中显示日期

时间:2018-11-07 06:50:43

标签: excel vba excel-vba

当前,我正在使用DOB组合框。现在,我有一个问题-从列表框中如何使它出现在组合框中?我想要编辑数据,因此希望它出现在组合框中。

日-Emp17 月-Emp18 年-Emp 19

This is the image

这是我的编码

Private Sub lstEmployee_DblClick(ByVal Cancel As MSForms.ReturnBoolean)

'dim the variables
Dim i As Integer

'find the selected list item
i = Me.lstEmployee.ListIndex

Dim methodsOfCommunication() As String

Me.Emp16.Value = Me.lstEmployee.Column(0, i)
Me.Emp1.Value = Me.lstEmployee.Column(1, i)
Me.Emp4.Value = Me.lstEmployee.Column(4, i)
Me.Emp5.Value = Me.lstEmployee.Column(5, i)
Me.Emp6.Value = Me.lstEmployee.Column(6, i)
Me.Emp7.Value = Me.lstEmployee.Column(7, i)
Me.Emp13.Value = Me.lstEmployee.Column(8, i)
Me.Emp14.Value = Me.lstEmployee.Column(9, i)
Me.Emp15.Value = Me.lstEmployee.Column(10, i)


Select Case Me.lstEmployee.Column(3, 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(2, 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
On Error GoTo 0

End Sub

0 个答案:

没有答案