Results 1 to 4 of 4

Populate listbox from 2 rows of cells

Threaded View

  1. #1
    Registered User
    Join Date
    11-28-2003
    Posts
    39

    Populate listbox from 2 rows of cells

    What i am trying to achieve is to list two ranges of cells in to seperate colums.
    But to only include non-emply cells from c6:j6.
    However the C5:J5 range is always popualted, this must also be filtered by the empty cells in range c6:j6.

    So in the end i might have: Col 1 = c6, e6, and j6. And col 2 = c5, e5, and j5

    So far i have the following code.

    ListBox1.ColumnCount = 2
    Set rng = ActiveSheet.Range("c6:j6")
    Set run = ActiveSheet.Range("c5:j5")
    For Each c In run
    For Each cell In rng
    If Not IsEmpty(cell) Then
    ListBox1.AddItem c.Value
    End If
    Next
    Next
    For Each cell In rng
    If Not IsEmpty(cell) Then
    ListBox1.AddItem cell.Value

    End If
    Next

    any help appreciated
    Last edited by mikewild2000; 04-09-2005 at 10:45 AM. Reason: small mistake

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1