【发布时间】:2015-03-13 18:30:09
【问题描述】:
我在 Excel 工作表中输入了combobox。我希望它能够工作,以便无权访问VBA 的用户可以从dropdown 中选择一个值,然后另一个单元格中的值将对这个值执行vlookup。
在第一个实例中,我插入了一个框并尝试基于此设置一个单元格值。
Sub InsertComboBox()
#inserts dropdown box on the front page and sets the values as the list of DMA from the pipe_totals sheet
#this should be the most complete list so will not change dependant on asset
Dim arearange As Range
Set arearange = Sheets("pipe_totals").Range("a:a")
lastrowi = Application.WorksheetFunction.CountA(arearange)
Sheets("front page").Activate
With Range("f5:g5")
Set Combo = ActiveSheet.DropDowns.Add(.Left, .Top, .Width, .Height)
End With
Combo.List() = Sheets("pipe_totals").Range("A2:A" & lastrowi).Value
.Range("k9").Value = Combo.Value 'only works on current combobox value which is 0
End Sub
我有什么方法可以设置这个,使vlookup 根据用户的选择是动态的?
【问题讨论】:
标签: excel vba combobox vlookup