Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Title heading in Listbox1

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Title heading in Listbox1

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
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
how do I link chart title & keep the number format in a heading Raj Charts and Charting in Excel 1 April 22nd 08 07:46 PM
how can I exclude a heading but show that heading in sheet. Hunter Excel Discussion (Misc queries) 4 January 8th 07 07:35 AM
Help with: ListBox1.AddItem (ws.Name) Ron de Bruin Excel Worksheet Functions 0 May 18th 05 07:02 PM
Listbox1 to Listbox2? Moretakitty Excel Programming 16 January 20th 05 10:25 PM
(Worksheet)Listbox1.additem = (Form)Listbox1.value ?? Tom Ogilvy Excel Programming 0 September 2nd 03 07:36 PM


All times are GMT +1. The time now is 12:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"