Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default additem listbox

Good day,

Is it possible to use the AddItem method to a 2-column ListBox?
My efforts has so far resulted in the code below but now I´am stuck.

Brgds

CG Rosén
-------------------------------------------------

For i = 2 To 50

If Sheets("constants").Cells(i, 6).Value = 1
Item1 = Sheets("constants").Cells(i, 4)
Item2 = Sheets("constants").Cells(i, 5)
UserForm2.ListBox1.AddItem Item1 ' add to column 1???
UserForm2.ListBox1.AddItem Item2 ' add to column 2???
End If
Next i



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default additem listbox

If Sheets("constants").Cells(i, 6).Value = 1
Item1 = Sheets("constants").Cells(i, 4)
Item2 = Sheets("constants").Cells(i, 5)
UserForm2.ListBox1.AddItem Item1 ' add to column 1
UserForm2.ListBox1.List(Listbox1.Listcount-1,1) = Item2 ' add to column
2
End If
Next i

--
Regards,
Tom Ogilvy


CG Rosén wrote in message
...
Good day,

Is it possible to use the AddItem method to a 2-column ListBox?
My efforts has so far resulted in the code below but now I´am stuck.

Brgds

CG Rosén
-------------------------------------------------

For i = 2 To 50

If Sheets("constants").Cells(i, 6).Value = 1
Item1 = Sheets("constants").Cells(i, 4)
Item2 = Sheets("constants").Cells(i, 5)
UserForm2.ListBox1.AddItem Item1 ' add to column 1???
UserForm2.ListBox1.AddItem Item2 ' add to column 2???
End If
Next i





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default additem listbox

Set ColumnCount = 2

Dim i As Long

Me.ListBox1.AddItem "" 'first add item
i = Me.ListBox1.ListCount - 1 'which row after add
Me.ListBox1.Column(0, i) = "AAA" 'column 1
Me.ListBox1.Column(1, i) = "BBB" 'column 2


-----Original Message-----
Good day,

Is it possible to use the AddItem method to a 2-column

ListBox?
My efforts has so far resulted in the code below but now

I´am stuck.

Brgds

CG Rosén
-------------------------------------------------

For i = 2 To 50

If Sheets("constants").Cells(i, 6).Value = 1
Item1 = Sheets("constants").Cells(i, 4)
Item2 = Sheets("constants").Cells(i, 5)
UserForm2.ListBox1.AddItem Item1 ' add to

column 1???
UserForm2.ListBox1.AddItem Item2 ' add to

column 2???
End If
Next i



.

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
additem to combobox with an array jocke Excel Discussion (Misc queries) 2 September 29th 05 07:56 PM
Help with: ListBox1.AddItem (ws.Name) Ron de Bruin Excel Worksheet Functions 0 May 18th 05 07:02 PM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM
Is refreshing listbox rowsource in listbox click event possible? Jeremy Gollehon[_2_] Excel Programming 4 September 25th 03 06:45 PM
additem to listbox built on the fly Tom Ogilvy Excel Programming 1 July 23rd 03 04:25 PM


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