PDA

View Full Version : [SOLVED] Listbox problem



gibbo1715
01-25-2005, 06:02 AM
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

Jacob Hilderbrand
01-25-2005, 06:08 AM
Replace ActiveCell with Cell.

gibbo1715
01-25-2005, 06:28 AM
That does it thanks
Just wondering is it possible to have different colours for Different items in a listbox?

Jacob Hilderbrand
01-25-2005, 06:33 AM
You're Welcome :beerchug:

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.