Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
listbox1.additem syntax for multiple columns
i am trying to load a two column listbox with the additem
method. The syntax for a single column listbox is: listbox1.additem ("text") For the life of me I cannot determine what the syntax is for multiple columns. Can anyone help me. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
listbox1.additem syntax for multiple columns
ListBox1.Additem "Text"
Listbox1.List(Listbox1.Count-1,1) = "Text2" -- Regards, Tom Ogilvy "Russ Robelen" wrote in message ... i am trying to load a two column listbox with the additem method. The syntax for a single column listbox is: listbox1.additem ("text") For the life of me I cannot determine what the syntax is for multiple columns. Can anyone help me. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
listbox1.additem syntax for multiple columns
To the amateur programmers like me who may read this thread, Tom was almost right. I think he meant for his code to read
ListBox1.Additem "Text Listbox1.List(Listbox1.ListCount-1,1) = "Text2 A word of caution - a quick read of listbox controls might suggest that the following code would load a two column listbox1 (ColumnCount property set to 2) with Row 0 Column 0 in row 0, column 0 and Row 0 Column 1 in row 0, column Row 1 Column 0 in row 1, column 0 and Row 1 Column 1 in row 1, column With userform .ListBox1.Clea For m = 0 to .Listbox1.List(m, 0) = Row & m & Column 0 .Listbox1.List(m, 1) = Row & m & Column 1 Nex End wit But it will not work. You will get a Run-time error 381 Could not set the List property. Invalid property array inde The problem is .Listbox1.List(m, 0) = ¦. Cannot create a row but can only modify an existing row. You must preface this statement with the statement ..Listbox1.AddItem = a blank row or any other text string will wor This statement creates a row that the following statements can then modify. What ever text string you add with the AddItem will be overwritten by the first statement that follows. The following code does work With userform .ListBox1.Clea For m = 0 to .Listbox1.AddItem = .Listbox1.List(m, 0) = Row & m & Column 0 .Listbox1.List(m, 1) = Row & m & Column 1 Nex End wit It took me more time than I care to admit to figure this out ----- Tom Ogilvy wrote: ---- ListBox1.Additem "Text Listbox1.List(Listbox1.Count-1,1) = "Text2 -- Regards Tom Ogilv "Russ Robelen" wrote in messag .. i am trying to load a two column listbox with the addite method. The syntax for a single column listbox is listbox1.additem ("text" For the life of me I cannot determine what the syntax i for multiple columns. Can anyone help me |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
listbox1.additem syntax for multiple columns
ignore this - testing
|
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
listbox1.additem syntax for multiple columns
ignore this - testing
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
ListBox1. add item myCell.entirerow | Excel Discussion (Misc queries) | |||
UserForm:Resume to ListBox1 | Excel Discussion (Misc queries) | |||
Help with: ListBox1.AddItem (ws.Name) | Excel Worksheet Functions | |||
Multiple Column ComboBox using Additem | Excel Programming | |||
(Worksheet)Listbox1.additem = (Form)Listbox1.value ?? | Excel Programming |