所以问题是我想将数组与具有两个值的多个行进行比较。数组的值链接到列表框中的一行。如果数组的值在这两个值之间,则必须删除列表框中的链接行。
因此,红色框中的单元格值不能介于绿色框,橙色框,蓝色框等两个值之间。schematic despcription
这些值与您在用户框中填写的值相关联。因此,当按下瓷砖berekenen(计算)时,遮阳篷将显示在列表框中。 Userbox with listbox
因此,我的第一个想法是为两个值之间的值着色,并根据此值将其从列表框中删除。但是没有成功,我无法自己解决这个问题。这是我的整个代码:
Private Sub Bereken_Click()
'Invullen van de cellen na het indrukken van de bereken knop'
If boogbreedte.Text = "" Then
MsgBox ("cannot Empty!")
Else
Range("Blad1!C2").Value = boogbreedte.Text
End If
If koppelstriplengte.Text = "" Then
MsgBox ("cannot Empty!")
Else
Range("Blad1!C4").Value = koppelstriplengte.Text
End If
If gatafstand.Text = "" Then
MsgBox ("cannot Empty!")
Else
Range("Blad1!C5").Value = gatafstand.Text
End If
If stramienenafstand.Text = "" Then
MsgBox ("cannot Empty!")
Else
Range("Blad1!C6").Value = stramienenafstand.Text
End If
If aantalstramienen.Text = "" Then
MsgBox ("cannot Empty!")
Else
Range("Blad1!C7").Value = aantalstramienen.Text
End If 'Uitlezen waarden'
With Blad3
Dim arr As Variant
arr = Range("A1:Z10").Value
Dim ii As Long, jj As Long
For ii = LBound(arr, 1) To UBound(arr, 1)
For jj = LBound(arr, 2) To UBound(arr, 2)
If arr(ii, jj) >= Range("AA11").Value And arr(ii, jj) <= Range("AB12").Value Then
Cells("A1:Z10").Interior.ColorIndex = 3
Else
End If
Next jj
Next ii
End With
'Na het drukken op de berekenknop naar volgende tab'
Pons.MultiPage1.Value = 1
'Uitlezen ponsafstand'
Dim ws As Worksheet
Dim rng As Range
Dim i As Long, j As Long, rw As Long
Dim Myarray() As String
Set ws = Sheets("Blad1")
'welke cellen uitlezen'
Set rng = ws.Range("F2:L11")
With Me.ListBox1
.Clear
.ColumnHeads = False
.ColumnCount = rng.Columns.Count
ReDim Myarray(rng.Rows.Count, rng.Columns.Count)
rw = 0
For i = 1 To rng.Rows.Count
For j = 0 To rng.Columns.Count
Myarray(rw, j) = rng.Cells(i, j + 1)
Next
rw = rw + 1
Next
.List = Myarray
'kolom breedte en aantal'
.ColumnWidths = "20;10;20;15;25;10;20"
.TopIndex = 0
End With
已经感谢您的时间