这应该很简单,但我很挣扎。现在,这段代码有效:
cboCategoryEdit1.List = Sheets(2).Range("A2:A40").Value
我试图通过改变组合框的填充方式来“清理”我的项目。我希望它是一个组合框,其范围只需要填充细胞。意思是我需要使用最后一行功能。我将代码更改为此,我只是收到“未找到方法或数据成员”的错误。这是我的问题代码:
Dim i As Range
With Sheets("xRef-Categories")
Set i = .Range("A2:A" & .Range("A" & .Rows.Count).End(xlUp).Row)
End With
Me.cboCategoryEdit1.ListFillRange = i.Address
感谢您对此提供任何帮助。
顺便说一句:Sheet2是“xref-Categories”
你只需要这个......
With Sheets("xRef-Categories")
Me.cboCategoryEdit1.List = .Range("A2:A" & .Range("A" & .Rows.Count).End(xlUp).Row).Value
End With
您可以像这样简化它:
With Sheets("xRef-Categories")
Me.cboCategoryEdit1.List = .Range("A2" , .Range("A" & .Rows.Count).End(xlUp)).Value
End With