1
我想根據單元格範圍(匹配)檢查列表框中的項目VBA從列表框對象匹配值到範圍
這是我迄今爲止所做的。
Dim j As Integer
Dim lItem As Long
Dim rowx as Long
rowx = 12
j = 0
For lItem = 0 To Worksheets("Bordereau Prep").ListBoxPlot.ListCount
If Worksheets("Bordereau Prep").ListBoxPlot.List(lItem) = Worksheets("Liste").Cells(rowx, 40 + j) Then
Worksheets("Bordereau Prep").ListBoxPlot.Selected(lItem) = True
j = j + 1
End If
Next lItem
此我想要做什麼,檢查列表是在range_pr_el
的項目,但它在拋出一個錯誤:
If Worksheets("Bordereau Prep").ListBoxPlot.List(lItem) = Worksheets("Liste").Cells(rowx, 40 + j) Then
告訴我「錯誤381:無法讀取列表屬性索引屬性表無效「。我不明白爲什麼,因爲它確實進入了循環,而且它確實按照它應該做的那樣做。缺少什麼來糾正錯誤?
預先感謝您使用
For lItem = 0 To Worksheets("Bordereau Prep").ListBoxPlot.ListCount - 1
當經歷for循環的最後一次迭代都會有訴訟等於列表項的數量
這就是拋出錯誤,謝謝 –
歡迎您!我很高興能夠提供幫助。 –