Hi,
I am trying to use a ListBox with multiple columns. I have set the properties so that columncount is 4 and columnheads is true and I can see the four distinct columns when the code is run. However, I can only seem to add data into the first column. I have tried changing the bound column or textcolumn but when I use AddItem, it always puts data in the first column.
Can anyone give me an example of how to populate all the columns in a ListBox please?
Thanks
Where are you populating from? is the source on a sheet?
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel consulting, free examples and tutorials visit Excel Consulting-Excel VBA
Check out the free Excel Toolbar
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
Code Tags: Make your code easier for us to read
It will eventually use an ADO Recordset but for test purposes I am just trying to hard-coded text to the columns. eg. ListBox1.AddItem "Hello".
How would I put "Hello" in the first column and "Goodbye" in the second one?
Like this
Code:With Me.ListBox1 .AddItem "hello" .List(.ListCount - 1, 1) = "Goodbye" End With
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel consulting, free examples and tutorials visit Excel Consulting-Excel VBA
Check out the free Excel Toolbar
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
Code Tags: Make your code easier for us to read
Great, that worked a charm! Thanks for your help.
Core 2 Quad Q6600 o/c @ 2.9GHz, 4Gb DDR2 1066MHz, HD5770 1Gb 850MHz, 2 x 750Gb HDD (RAID 0), Benq G2222HDL 22" 1920 x 1080 LED, Win7 Ultimate
Toshiba Satellite A665-11M, 16" 1366 x 768, i7 720QM 1.6GHz, 4Gb DDR2 1066MHz, GT330M 1Gb, 500Gb HDD, Win7 Home Premium
Amiga 1200, 3.1 ROM, Blizzard 1230-IV 68030 50MHz CPU, 68882 FPU, 16Mb, 4Gb CF-based HDD, Custom IDE CDROM Drive, Indivision AGA Scandoubler, Custom VGA output, CWB 3.1 ADVSP, Benq G2222HDL 22" 1920 x 1080 LED (720p resolution)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks