|
回车后不跳转下一选项,简化用数字录入?
我用03版,打开你的文件,日期控件丢失!就不上附件了!
你自己改动一下!
第一个 窗体初始化 替换你原来的!
第二个代码是 新增的! - '初始化窗体数据
- Private Sub UserForm_Initialize()
-
- '初始化日期
- '日期 = VBA.Date()
- '日期key = VBA.Date()
-
- '初始化场
- 场.List = Array("金龙", "金龙2场")
- 场.ListIndex = 0
- 场.Style = fmStyleDropDownCombo
- '初始性别
- 性别.List = Array("男", "女")
- 性别.ListIndex = 0
- 性别.Style = fmStyleDropDownCombo
- '初始部门
- 部门.List = Array("生产部", "财务部", "后勤部", "采购部", "销售部", "人力资源部")
- 部门.ListIndex = 0
- 部门.Style = fmStyleDropDownCombo
- '初始当前状态
- 当前状态.List = Array("在职", "离职")
- 当前状态.ListIndex = 0
- 当前状态.Style = fmStyleDropDownCombo
- End Sub
复制代码 下面的代码新增- Private Sub 场_Exit(ByVal Cancel As MSForms.ReturnBoolean)
- If IsNumeric(场) Then
- If CInt(场) <= 场.ListCount Then
- 场.Value = 场.List(CInt(场.Value) - 1)
- Else
- Cancel = True
- End If
- End If
- End Sub
- Private Sub 性别_Exit(ByVal Cancel As MSForms.ReturnBoolean)
- If IsNumeric(性别) Then
- If CInt(性别) <= 性别.ListCount Then
- 性别.Value = 性别.List(CInt(性别.Value) - 1)
- Else
- Cancel = True
- End If
- End If
- End Sub
- Private Sub 部门_Exit(ByVal Cancel As MSForms.ReturnBoolean)
- If IsNumeric(部门) Then
- If CInt(部门) <= 部门.ListCount Then
- 部门.Value = 部门.List(CInt(部门.Value) - 1)
- Else
- Cancel = True
- End If
- End If
- End Sub
- Private Sub 当前状态_Exit(ByVal Cancel As MSForms.ReturnBoolean)
- If IsNumeric(当前状态) Then
- If CInt(当前状态) <= 当前状态.ListCount Then
- 当前状态.Value = 当前状态.List(CInt(当前状态.Value) - 1)
- Else
- Cancel = True
- End If
- End If
- End Sub
复制代码
|
|