使用VBA(数据validation)使列表下降
我想要一个单元格下拉其数据validation列表。 我不想“创build一个下拉数据validation列表”。 我已经有了这个列表,我只是想让它使用VBA下载。
有没有办法做到这一点?
例如:如果我把数据放在单元格A1中,我希望单元格B1被选中,并且其数据validation列表应该下拉。 我已经有select单元格B1的代码,如果单元格A1有任何值,但我还没有想出如何使单元格的列表下拉。
示例代码:
Private Sub Worksheet_Change(ByVal Target As Range) With Sh1 ' If row 1 in active column has a "1" in it, ' we want to select the column to the right and drop down its list If .Cells(1, Target.Column).Value = 1 And Target.Value <> "" Then Target.Offset(0, 1).Select ' Code for dropping down the cell's list End If End With End Sub
select单元格并使用:
Application.SendKeys ("%{UP}")
不在我的电脑,所以我无法validation,但如果你需要更多的帮助看这里: