Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default Help with adding array item to multicolumn listbox

I am using a keyword to filer an existsing array. As I come across data that
fits the filter, I want to add that array record to the listbox. It is a 7
column listbox. I cannot get the add to work.

SortKey = combobox1.Value
listbox1.Clear
With listbox1
.ColumnCount = 7
.ColumnWidths = "35;70;160;75;60;60"
ReDim lVar(1, 7)
For X = 1 To UBound(tempData)
If tempData(X, 29) = SortKey Then
lVar(1, 1) = tempData(X, 28)
lVar(1, 2) = tempData(X, 22)
lVar(1, 3) = tempData(X, 2)
lVar(1, 4) = tempData(X, 21)'
lVar(1, 5) = Format(tempData(X, 27), "MM/DD/YY")
lVar(1, 6) = tempData(X, 18)
lVar(1, 7) = tempData(X, 29)
listbox1.additem = lVar
End If
Next X
End With

No matter how I phrase the add item line, it will not add the record to the
listbox. What is the correct code for this? I want the new data found to be
appended to the existing data as it loops through the tempData array.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Help with adding array item to multicolumn listbox

I'd try:

SortKey = combobox1.Value
listbox1.Clear
With listbox1
.ColumnCount = 7
.ColumnWidths = "35;70;160;75;60;60"
ReDim lVar(1, 7)
For X = 1 To UBound(tempData)
If tempData(X, 29) = SortKey Then
.additem tempData(X, 28)
.list(.listcount -1, 1) = tempData(X, 22)
.list(.listcount - 1, 2) = tempData(X, 2)
.list(.listcount - 1, 3) = tempData(X, 21)
.list(.listcount-1,4)=Format(tempData(X, 27), "MM/DD/YY")
.list(.listcount-1,5)=tempData(X, 18)
.list(.listcount-1,6) =tempData(X, 29)
End If
Next X
End With


jayklmno wrote:

I am using a keyword to filer an existsing array. As I come across data that
fits the filter, I want to add that array record to the listbox. It is a 7
column listbox. I cannot get the add to work.

SortKey = combobox1.Value
listbox1.Clear
With listbox1
.ColumnCount = 7
.ColumnWidths = "35;70;160;75;60;60"
ReDim lVar(1, 7)
For X = 1 To UBound(tempData)
If tempData(X, 29) = SortKey Then
lVar(1, 1) = tempData(X, 28)
lVar(1, 2) = tempData(X, 22)
lVar(1, 3) = tempData(X, 2)
lVar(1, 4) = tempData(X, 21)'
lVar(1, 5) = Format(tempData(X, 27), "MM/DD/YY")
lVar(1, 6) = tempData(X, 18)
lVar(1, 7) = tempData(X, 29)
listbox1.additem = lVar
End If
Next X
End With

No matter how I phrase the add item line, it will not add the record to the
listbox. What is the correct code for this? I want the new data found to be
appended to the existing data as it loops through the tempData array.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default Help with adding array item to multicolumn listbox

Thank you thank you thank you...

"Dave Peterson" wrote:

I'd try:

SortKey = combobox1.Value
listbox1.Clear
With listbox1
.ColumnCount = 7
.ColumnWidths = "35;70;160;75;60;60"
ReDim lVar(1, 7)
For X = 1 To UBound(tempData)
If tempData(X, 29) = SortKey Then
.additem tempData(X, 28)
.list(.listcount -1, 1) = tempData(X, 22)
.list(.listcount - 1, 2) = tempData(X, 2)
.list(.listcount - 1, 3) = tempData(X, 21)
.list(.listcount-1,4)=Format(tempData(X, 27), "MM/DD/YY")
.list(.listcount-1,5)=tempData(X, 18)
.list(.listcount-1,6) =tempData(X, 29)
End If
Next X
End With


jayklmno wrote:

I am using a keyword to filer an existsing array. As I come across data that
fits the filter, I want to add that array record to the listbox. It is a 7
column listbox. I cannot get the add to work.

SortKey = combobox1.Value
listbox1.Clear
With listbox1
.ColumnCount = 7
.ColumnWidths = "35;70;160;75;60;60"
ReDim lVar(1, 7)
For X = 1 To UBound(tempData)
If tempData(X, 29) = SortKey Then
lVar(1, 1) = tempData(X, 28)
lVar(1, 2) = tempData(X, 22)
lVar(1, 3) = tempData(X, 2)
lVar(1, 4) = tempData(X, 21)'
lVar(1, 5) = Format(tempData(X, 27), "MM/DD/YY")
lVar(1, 6) = tempData(X, 18)
lVar(1, 7) = tempData(X, 29)
listbox1.additem = lVar
End If
Next X
End With

No matter how I phrase the add item line, it will not add the record to the
listbox. What is the correct code for this? I want the new data found to be
appended to the existing data as it loops through the tempData array.


--

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
Adding item in listbox volabos Excel Worksheet Functions 0 December 3rd 07 11:47 AM
Adding item in listbox volabos Excel Worksheet Functions 0 December 3rd 07 11:27 AM
Adding and Reading a ListBox Item Geoff Excel Programming 1 May 29th 05 12:39 AM
Adding Header to multicolumn ListBox Wellie[_2_] Excel Programming 1 February 19th 04 10:31 AM
populating multicolumn listbox with an array instead of... notsureofthatinfo Excel Programming 0 November 5th 03 10:18 PM


All times are GMT +1. The time now is 04:25 AM.

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"