Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I got this in the VBA help. You can play with it and see if it will adapt to
a ListBox. I have not tried it, but the combobox and listbox both use AddItem method, so I imagine it will work. First run this example on a UserForm with a combobox to see if it does what you want. If it does, then maybe you can adapt. Set myBar = CommandBars("Custom") Set myControl = myBar.Controls.Add(Type:=msoControlComboBox) With myControl .AddItem Text:="First Item", Index:=1 .AddItem Text:="Second Item", Index:=2 .DropDownLines = 3 .DropDownWidth = 75 .ListHeaderCount = 1 End With "John" wrote: Hi, Searched the archives and found a similar question, though the answers whilst useful did not sovle my problem, so posting hte question again. How using VBA can i make the text in D1 the Header in my Listbox. I'm using VBA to build the Rowsource. I know if i were to set this manually in the Rowsource then the text in D1 appears as the column heading in the Listbox, but as each Item comes from filtered data, even though D1 is outside of the filtered data range, D1 appears as the first Item in the Listbox. Mike Milligan posted a similar question back in October this year (I think!) under the title "Adding Headers To A Listbox" All help on this gratefully appreciated. Thanks John |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how do I link chart title & keep the number format in a heading | Charts and Charting in Excel | |||
how can I exclude a heading but show that heading in sheet. | Excel Discussion (Misc queries) | |||
Help with: ListBox1.AddItem (ws.Name) | Excel Worksheet Functions | |||
Listbox1 to Listbox2? | Excel Programming | |||
(Worksheet)Listbox1.additem = (Form)Listbox1.value ?? | Excel Programming |