LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Adding Items to a ListBox-Eliminating Blanks-Part II

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(PackagesAvail able.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

--
Message posted from http://www.ExcelForum.com

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Eliminating blanks LiAD Excel Worksheet Functions 5 July 8th 09 06:01 PM
Adding items to columns in a listbox Daniel Bonallack Excel Discussion (Misc queries) 1 May 7th 07 04:45 PM
Adding Items to ListBox-eliminating Blanks jpendegraft[_9_] Excel Programming 10 July 16th 04 02:25 AM
Adding Items to a LISTBOX--eliminating Blank Lines jpendegraft[_8_] Excel Programming 2 May 1st 04 03:18 PM
Adding items to a spreadsheet from a user form listbox aet-inc[_4_] Excel Programming 1 December 3rd 03 05:13 AM


All times are GMT +1. The time now is 10:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"