好的,所以我设置了一个组合框:
With Pclient
Pclient.AddItem "CMN"
Pclient.AddItem "RSS"
Pclient.AddItem "ORD"
End With
当我为Pclient选择一个选项时,我希望将Pcodclient设置为X,这样它就可以设置客户端代码的值而无需手动输入。
With Pclient
Pclient.AddItem "CMN"
Pclient.AddItem "RSS"
Pclient.AddItem "ORD"
End With
我该怎么做?
我尝试过运行一些
在细胞部分之前...但它没有工作。Cells(ActiveCell.Row, 2).Value = Pclient.Value
Cells(ActiveCell.Row, 3).Value = Pcodclient.Value
编辑:
Cells(ActiveCell.Row, 2).Value = Pclient.Value
Cells(ActiveCell.Row, 3).Value = Pcodclient.Value
IF Pclient.Value = CMN then Pcodclient.Value = X
我在Pcodclient.Value =" LSR000"
上获得了无效限定符我该如何解决这个问题?
答案 0 :(得分:0)
使用更改事件更新Pcodclient
Private Sub Pclient_Change()
If Pclient.Value = "CMN" Then
Pcodclient = "X"
End If
If Pclient.Value = "RSS" Then
Pcodclient = "Y"
End If
If Pclient.Value = "ORD" Then
Pcodclient = "Y"
End If
End Sub
Private Sub NewMethod()
'Do something
End Sub
答案 1 :(得分:0)
我建议通过将Combobox
链接到单元格(have a look here)来创建VLOOKUP
。现在使用 $(document).ready(function()
{
$("#yourGridId th:nth-child(2)").hide();
$("#yourGridId td:nth-child(2)").hide();
}
从表中获取值。这意味着你不必做任何VBA