シートの列 "M"に "!UKINADMISSIBLE"の検索コードがあります。リストボックス(listbox1)に "!UKINADMISSIBLE"を持つ選択された行がすべて表示されます。それはうまく動作しますが、シートから「!UKINADMISSIBLE」をすべて削除すると、このコード行でこのエラー(リストプロパティ、無効なプロパティ値を設定できませんでした)を得られます--->Me.ListBox1.List = arrLstBox )--->エラー 誰でも助けてくれたら助かりますか?はリストプロパティを設定できませんでした。無効なプロパティ値エラー
Private Sub btnIUK_Click()
Dim arrLstBox()
Dim rng, FoundCell, tmpCell As Range
Dim i, j, numRows, lastColumn, lastRow As Long
Dim FirstAddress, searchFor, colWidth As String
Set rng = ActiveSheet.UsedRange
numRow = 0
With rng
lastRow = .Rows.Count
lastColumn = .Columns.Count
End With
Me.ListBox1.ColumnCount = lastColumn
Me.ListBox1.ColumnWidths = "60;70;190;40;90;90;70;80;50;60;90;120;5"
Set FoundCell = rng.Find(what:="!UKINADMISSIBLE", LookIn:=xlValues, lookat:=xlWhole)
If Not FoundCell Is Nothing Then _
FirstAddress = FoundCell.Address
Do Until FoundCell Is Nothing
Set FoundCell = rng.FindNext(after:=FoundCell)
If FoundCell.Address = FirstAddress Then
numRow = numRow + 1
Exit Do
ElseIf FoundCell.Row <> rng.FindNext(after:=FoundCell).Row Then
numRow = numRow + 1
End If
ReDim arrLstBox(1 To numRow + 1, 1 To lastColumn + 1)
Loop
Do Until FoundCell Is Nothing
For i = 1 To numRow
For j = 1 To lastColumn
If Not IsEmpty(Cells(FoundCell.Row, j).Value) Then
arrLstBox(i, j) = Cells(FoundCell.Row, j).Value
End If
Next j
Set FoundCell = rng.FindNext(after:=FoundCell)
If FoundCell.Address = FirstAddress Then _
Exit For
Next i
If FoundCell.Address = FirstAddress Then _
Exit Do
Loop
Me.ListBox1.List = arrLstBox()----->ERROR
lastRow = ListBox1.ListCount
MsgBox "Records Found = " & lastRow, vb, "Inadmissibles On UK Sectors"
End Subode here
感謝の負荷は、それを本当に感謝しています。もう一度ありがとう:) –
Ambie、本当に涼しいありがとう –