J
jpendegraft
Tom solved one issue...using a variable in the array...but I still nee
to eliminate the blank lines that this generates...
I want it to ONLY add lines the satisfy the conditions of the I
statement. currently it will add a line with NO DATA if the statemen
is false..
Sub PopulateBox()
Dim data()
Set PackagesAvailable = ThisWorkbook.Sheets("BrandCount")
Packcount
Application.WorksheetFunction.CountA(PackagesAvailable.Range("A:A"))
Dim i As Integer
ListBox1.Clear
ReDim data(1 To Packcount, 1 To 2)
On Error Resume Next
For i = 1 To Packcount
If Sheet10.Cells(i, 1) = cbstate.Value Then
data(i, 1) = PackagesAvailable.Cells(i, 2).Value
data(i, 2) = PackagesAvailable.Cells(i, 3).Value
End If
Next i
ListBox1.ColumnCount = 2
ListBox1.list = data
End Su
to eliminate the blank lines that this generates...
I want it to ONLY add lines the satisfy the conditions of the I
statement. currently it will add a line with NO DATA if the statemen
is false..
Sub PopulateBox()
Dim data()
Set PackagesAvailable = ThisWorkbook.Sheets("BrandCount")
Packcount
Application.WorksheetFunction.CountA(PackagesAvailable.Range("A:A"))
Dim i As Integer
ListBox1.Clear
ReDim data(1 To Packcount, 1 To 2)
On Error Resume Next
For i = 1 To Packcount
If Sheet10.Cells(i, 1) = cbstate.Value Then
data(i, 1) = PackagesAvailable.Cells(i, 2).Value
data(i, 2) = PackagesAvailable.Cells(i, 3).Value
End If
Next i
ListBox1.ColumnCount = 2
ListBox1.list = data
End Su