Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
DYNAMIC LISTBOX
I would like to know if there is a way to have a listbox return only values
that meet two critera. Like if Cell A1 = 5 and Cell A2 = 20, i would like only to return the values located in a diffrent sheet(column B) between rows 5 and 20. Then those values would be put in the ListBox. Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
DYNAMIC LISTBOX
May be
define A1 as low define A2 as high list box refers to =OFFSET(Sheet2!$B$1,low-1,0,high-low+1,1) "daphoenix" wrote in message ... I would like to know if there is a way to have a listbox return only values that meet two critera. Like if Cell A1 = 5 and Cell A2 = 20, i would like only to return the values located in a diffrent sheet(column B) between rows 5 and 20. Then those values would be put in the ListBox. Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
DYNAMIC LISTBOX
You don't say where your listbox is ie worksheet or userform?
sample code below assumes listbox is on a worksheet but approach can be adapted for userform Sub AddListboxData() Dim Rng1 As Range Dim Val1 As Single Dim Val2 As Single Set Rng1 = Worksheets("Sheet2").Range("B5:B20") With Worksheets("Sheet1") Set Lbox1 = .ListBox1 Val1 = .Range("A1") Val2 = .Range("A2") .ListBox1.Clear For Each Item In Rng1 Select Case Item Case Is = Val1, Val2 .ListBox1.AddItem Item End Select Next Item End With End Sub -- jb "daphoenix" wrote: I would like to know if there is a way to have a listbox return only values that meet two critera. Like if Cell A1 = 5 and Cell A2 = 20, i would like only to return the values located in a diffrent sheet(column B) between rows 5 and 20. Then those values would be put in the ListBox. Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Dynamic link with 2 dependent listbox? | Excel Discussion (Misc queries) | |||
dynamic fill of listbox - need help | Excel Programming | |||
Write a Listbox list to a dynamic range | Excel Programming | |||
Dynamic Multi Column ListBox | Excel Programming | |||
Making a Dynamic List in Listbox | Excel Programming |