ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   additem (https://www.excelbanter.com/excel-programming/409957-additem.html)

ranswrt

additem
 
How do I use 'additem' on a listbox that has 7 columns in it?
Thanks

JLGWhiz

additem
 
For multi column listBox use the list property in the UF initialize event.

Private Sub UserForm_Initialize()
ListBox1.List(0, 0) = "FirstRow, FirstCol"
ListBox1.List(0, 1) = "FirstRow, SecondCol"
ListBox1.List(0, 2) = "FirstRow, ThirdCol"
End Sub

Remember the row and column indexes are zero based. If you have a large
number of items to add, you might want to use list fill from a range.

"ranswrt" wrote:

How do I use 'additem' on a listbox that has 7 columns in it?
Thanks


ranswrt

additem
 
I already have a listbox with items in it. I also have textboxes that get
the new data to add the the list box. What is the best way to add the new
data to the end of the list?
Thanks

"JLGWhiz" wrote:

For multi column listBox use the list property in the UF initialize event.

Private Sub UserForm_Initialize()
ListBox1.List(0, 0) = "FirstRow, FirstCol"
ListBox1.List(0, 1) = "FirstRow, SecondCol"
ListBox1.List(0, 2) = "FirstRow, ThirdCol"
End Sub

Remember the row and column indexes are zero based. If you have a large
number of items to add, you might want to use list fill from a range.

"ranswrt" wrote:

How do I use 'additem' on a listbox that has 7 columns in it?
Thanks



All times are GMT +1. The time now is 09:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com