Consulting

Results 1 to 4 of 4

Thread: Listbox problem

  1. #1
    VBAX Expert
    Joined
    Jan 2005
    Posts
    574
    Location

    Listbox problem

    I am trying to add items from a dynamic range into a listbox only if the value in a cell is = ""

    The code I have is

    Dim Rng As Range
      With ThisWorkbook.Sheets("Actions")
              Set Rng = .Range("A1", .Range("A65536").End(xlUp))
          End With
    For Each cell In Rng.Cells
              With Me.ListBox1
              If ActiveCell.Offset(0, 4).Value = "" Then
              .AddItem cell.Value
              .List(.ListCount - 1, 1) = cell.Offset(0, 2).Value
              '.List(.ListCount - 1, 1) = cell.Offset(0, 2).Value
               End If
              End With
          Next cell
    This shows all of the range regardless

    Any help please

  2. #2
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    Replace ActiveCell with Cell.

  3. #3
    VBAX Expert
    Joined
    Jan 2005
    Posts
    574
    Location
    That does it thanks
    Just wondering is it possible to have different colours for Different items in a listbox?

  4. #4
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    You're Welcome

    And I don't believe that it would be possible to have items in a List Box colored diferently.

    You could add Check Boxes or Option Buttons and color those seperately.

Posting Permissions

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