我在Excel中创建了一个文档,其中我希望用户通过单元格和组合框来填写。
如果我可以使用数据验证,解决方案将很容易,但这不允许自动填充。
我想出了从组合框到组合框的选项卡
Private Sub CBO0_KeyDown(ByVal Keycode As MSForms.ReturnInteger, ByVal shift As Integer)
If Keycode = 9 Then
CBO1.Activate
End If
End Sub
我还想出了如何从Combobox到Cell的选项卡。
Private Sub CBO1_KeyDown(ByVal Keycode As MSForms.ReturnInteger, ByVal shift As Integer)
If Keycode = 9 Then
Range("D10").Activate
End If
End Sub
剩下的是,
我需要Cell解决方案在VBA中,因为Excel中的解决方案不能在组合框和单元格之间工作。
想要了解一下Tab命令,
我不能更改订单,否则整张表格就不能用了。
发布于 2018-10-26 05:29:55
我假设这些是工作表上的activeX组合框。使用worksheet_change事件,change A1和combobox1将被激活,change combobox1和B1将被选中,change B1和Combobox2将被激活。
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Address = "$A$1" Then Me.ComboBox1.DropDown
If Target.Address = "$B$1" Then Me.ComboBox2.DropDown
End Sub
Private Sub ComboBox1_Click()
Me.Range("B1").Select
End Sub
Private Sub ComboBox2_Click()
Me.Range("C1").Select
End Sub
https://stackoverflow.com/questions/53009239
复制相似问题