Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 43
Default Setting and filter Listbox data

Hi all,

I rarely use listboxes and this has got me foxed.

I have a user form where a PO number can be selected from a list
(fmPOmaint.cbPOnum). It is possible for any PO to have date conflicts and I
want to call another form that simply lists all the conflicts.

I have an array called po_conflicts (varaible number of rows x 6 columns)
which has pre stored any existing conflicts. I have used
lbConflicts.List = PO_conflicts
to show the array in the listbox but how can I filter it so that only the
required POnum is shown.

Is there something like:

lbConflicts.List = PO_conflicts Where PO_Conflicts( column 0.value) =
fmPOmaint.cbPOnum

Cheers all.

Giz
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Setting and filter Listbox data

You can loop through your range looking for matches. When you find one, you can
add it to the listbox.

But it kind of looks like .cbPOnum is really a combobox. Maybe you can modify
this to do what you want:

Option Explicit
Private Sub UserForm_Initialize()

Me.ComboBox1.List = Worksheets("POs").Range("a1:A10").Value
Me.ListBox1.RowSource = ""
Me.ListBox1.Clear
Me.ListBox1.ColumnCount = 6

End Sub
Private Sub ComboBox1_Change()

Dim myRng As Range
Dim myCell As Range
Dim iCtr As Long

Me.ListBox1.Clear
If Me.ComboBox1.ListIndex -1 Then
With Worksheets("conflicts")
Set myRng = .Range("a1:F" & .Cells(.Rows.Count, "A").End(xlUp).Row)
End With

For Each myCell In myRng.Columns(1).Cells
If LCase(myCell.Value) = LCase(Me.ComboBox1.Value) Then
With Me.ListBox1
.AddItem myCell.Value
For iCtr = 1 To 5
.List(.ListCount - 1, iCtr) _
= myCell.Offset(0, iCtr).Value
Next iCtr
End With
End If
Next myCell
End If

End Sub

If you really meant an array, you'll need to modify this.



Gizmo63 wrote:

Hi all,

I rarely use listboxes and this has got me foxed.

I have a user form where a PO number can be selected from a list
(fmPOmaint.cbPOnum). It is possible for any PO to have date conflicts and I
want to call another form that simply lists all the conflicts.

I have an array called po_conflicts (varaible number of rows x 6 columns)
which has pre stored any existing conflicts. I have used
lbConflicts.List = PO_conflicts
to show the array in the listbox but how can I filter it so that only the
required POnum is shown.

Is there something like:

lbConflicts.List = PO_conflicts Where PO_Conflicts( column 0.value) =
fmPOmaint.cbPOnum

Cheers all.

Giz


--

Dave Peterson
Reply
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
Consulting Access from Excel [email protected] Excel Discussion (Misc queries) 4 February 6th 07 05:44 PM
Automatic filter during import of external data? CW Excel Discussion (Misc queries) 0 November 29th 06 11:51 AM
Vlookup to Return a Range of Data James Excel Discussion (Misc queries) 0 July 13th 06 09:44 PM
Inserting Filtered RC cell information into other worksheets Dennis Excel Discussion (Misc queries) 10 July 30th 05 01:54 AM
Custom Auto Filter default setting should be contains dmc Excel Worksheet Functions 0 June 14th 05 07:54 AM


All times are GMT +1. The time now is 03:13 PM.

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

About Us

"It's about Microsoft Excel"