Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Listbox Rowsource Headings Multi columns Copy Range If Then Conditional

(long subject designed for future searches)
Excel 2000
Read many posts and tried alot of code, but still need your help.
In practice a User is trying to check if any item number is in stock
and the QTY on hand and in which warehouse. So user presses command
button to open UserForm1 which contains TextBox:txtPartNo and
Listbox:ListBox1.
User enters Item number and then matching rows should be presented to
Listbox1.
HEADINGS are required so this means I can not use ListBox1.AddItem or
an array and must use ROWSOURCE of a Range to feed the Listbox, the
Range could be Dynamic I guess. But first the matching rows have to
be found and then copy/pasted to another range.

So the steps I think a
1. If-Then-Conditional of the existing data range(sample data below)
and copy/paste those matching rows with specific columns, over to
another range/sheet.
2. Set a range name for the newly pated rows(THEY NEED COLUMN
HEADINGS)
3. Set the Rowsource to that recently copy/pasted range

Here is what I have so far, but it is barely working:
Dim cell As Range
Dim rng As Range
Dim ws As Worksheet

Set ws = ThisWorkbook.Sheets("Sheet1")
Set rng = ws.Range("A2:A" & ws.Range("A65536").End(xlUp).Row)

For Each cell In rng
If cell.Value = Me.txtPartNo.Text Then
cell.Offset(0, 1).Range("A1").Copy _
Destination:=Sheets("Sheet2").Cells(1, 1)
End If
Next

With ListBox1
.rowsource = "OUR RANGE JUST CREATED?"
End With
End Sub


Sample Data(actually an external workbook)
Item Whouse Description UOM QTY
1158 LLR AKM2C MXR3 EA 3
1159 AER AKM3 PACK EA 0
1160 BOS AKM6 PACK EA 7
1164 DEX 547A UNIT EA 2
1158 TTL AKM2C MXR3 EA 5

User enters "1158" and then
listbox1 should look like this:
NOTE that one column, UOM, was skipped over!
Item Whouse Description QTY
1158 LLR AKM2C MXR3 3
1158 TTL AKM2C MXR3 5
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
Listbox rowsource on Userform Wendy Excel Discussion (Misc queries) 6 February 28th 08 05:46 PM
RowSource in ListBox aet-inc[_2_] Excel Programming 1 December 3rd 03 12:41 AM
Multi-columns in a ListBox Tom Atkisson Excel Programming 1 October 5th 03 10:27 PM
Is refreshing listbox rowsource in listbox click event possible? Jeremy Gollehon[_2_] Excel Programming 4 September 25th 03 06:45 PM
listbox rowsource Christy[_2_] Excel Programming 4 September 20th 03 11:44 PM


All times are GMT +1. The time now is 11:29 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"