UserForm ListBox不接受超过10个元素?运行时错误“ 380”

时间:2019-05-15 19:34:17

标签: excel vba

Excel VBA中用户窗体上的多选列表框没有正确填充,超过了第十列。

我已将列数显式设置为13,我的语法似乎合适。

我已经阅读了其他一些主题,只是我得到的提示是ListView项,似乎无法弄清楚如何进入工具箱。

Do While Not FetchSearch Is Nothing

                    FetchPositionVar = FetchSearch.Address

                    PossibleRecordsList.AddItem

                    ListPos = PossibleRecordsList.ListCount

                    PossibleRecordsList.List(ListPos - 1, 0) = Trim(ws.Cells(FetchSearch.Row, 19).Value)
                    PossibleRecordsList.List(ListPos - 1, 1) = Trim(ws.Cells(FetchSearch.Row, 7).Value)
                    PossibleRecordsList.List(ListPos - 1, 2) = Trim(ws.Cells(FetchSearch.Row, 8).Value)
                    PossibleRecordsList.List(ListPos - 1, 3) = Trim(ws.Cells(FetchSearch.Row, 10).Value)
                    PossibleRecordsList.List(ListPos - 1, 4) = Trim(ws.Cells(FetchSearch.Row, 11).Value)
                    PossibleRecordsList.List(ListPos - 1, 5) = Trim(ws.Cells(FetchSearch.Row, 12).Value)
                    PossibleRecordsList.List(ListPos - 1, 6) = Trim(ws.Cells(FetchSearch.Row, 1).Value)
                    PossibleRecordsList.List(ListPos - 1, 7) = Trim(ws.Cells(FetchSearch.Row, 2).Value)
                    PossibleRecordsList.List(ListPos - 1, 8) = Trim(ws.Cells(FetchSearch.Row, 4).Value)
                    PossibleRecordsList.List(ListPos - 1, 9) = Trim(ws.Cells(FetchSearch.Row, 5).Value)
                    PossibleRecordsList.List(ListPos - 1, 10) = Trim(ws.Cells(FetchSearch.Row, 6).Value)
                    PossibleRecordsList.List(ListPos - 1, 11) = Trim(ws.Cells(FetchSearch.Row, 15).Value)
                    PossibleRecordsList.List(ListPos - 1, 12) = RecordYear

                    Set FetchSearch = FetchRange.Find(what:=FetchDataMatch, After:=Range(FetchPositionVar), SearchDirection:=xlNext, LookAt:=xlPart)

                    If FirstFindPositionVar = FetchSearch.Address Then
                        Exit Do
                    End If
                Loop

我正在从多个工作表中填充一个多选列表框。 每个列表项都是一个数组,其中包含13个元素,是从其中一个工作表上的一行中提取出来的,搜索后该行具有要显示的相关数据。

该列表将包含多个“可能正确的记录”,然后显示给用户进行多选。选定的记录被放入另一个列表中,并用于生成报告。

当到达第11个元素时,出现运行时错误380

0 个答案:

没有答案