vba复合框下拉赋值问题
DimcdyearAsIntegercdyear=cdyTxt.TextIfcdyear=1ThencdFrm.cdcbb.List=Array(1)ElseIfcdye...
Dim cdyear As Integer
cdyear = cdyTxt.Text
If cdyear = 1 Then
cdFrm.cdcbb.List = Array(1)
ElseIf cdyear = 2 Then
cdFrm.cdcbb.List = Array(1, 2)
ElseIf cdyear = 3 Then
cdFrm.cdcbb.List = Array(1, 2, 3)
ElseIf cdyear = 4 Then
cdFrm.cdcbb.List = Array(1, 2, 3, 4)
ElseIf cdyear = 5 Then
cdFrm.cdcbb.List = Array(1, 2, 3, 4, 5)
End If
如上,我用一个文本框赋值给cdyear,然后要给复合框的下拉菜单赋值小于等于cdyear且大于0的整数数组序列,请问有什么简便的方法,谢谢 展开
cdyear = cdyTxt.Text
If cdyear = 1 Then
cdFrm.cdcbb.List = Array(1)
ElseIf cdyear = 2 Then
cdFrm.cdcbb.List = Array(1, 2)
ElseIf cdyear = 3 Then
cdFrm.cdcbb.List = Array(1, 2, 3)
ElseIf cdyear = 4 Then
cdFrm.cdcbb.List = Array(1, 2, 3, 4)
ElseIf cdyear = 5 Then
cdFrm.cdcbb.List = Array(1, 2, 3, 4, 5)
End If
如上,我用一个文本框赋值给cdyear,然后要给复合框的下拉菜单赋值小于等于cdyear且大于0的整数数组序列,请问有什么简便的方法,谢谢 展开
1个回答
展开全部
您好,ComboBox1.RowSource = "sheet1!A1:A" & i
dim i as long
dim j as long
dim sht as worksheet
set sht=sheets("sheet1")
set i=sht.range("A1").end(xlup).row
for j=1 to i
ComboBox1.additem sht.cells(i,1)
end j
dim i as long
dim j as long
dim sht as worksheet
set sht=sheets("sheet1")
set i=sht.range("A1").end(xlup).row
for j=1 to i
ComboBox1.additem sht.cells(i,1)
end j
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询