以下代码是否存在明显问题?我想遍历所有列表框并填充所选项目。
Dim lRw As Integer
Dim iX As Integer, iY As Integer
Dim i As Integer
For i = 1 To 10
With ActiveSheet
.Columns(i + 10).ClearContents
End With
For iX = 0 To ListBox(i).ListCount - 1
If ListBox(i).Selected(iX) = True Then
With Sheet1
lRw = .Cells(.Rows.Count, i + 11).End(xlUp).Row + 1
For iY = 0 To ListBox(i).ColumnCount - 1
.Cells(lRw, iY + i).Value = ListBox(i).List(iX, iY)
Next iY
End With
End If
Next iX
Next i