Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default Colum heads in multcolumn listbox

I got here code which display multicolum list box. I would like to have
column heads in listbox. If it's possible my colum heads are in celle
F12:F14.

Option Explicit
Private Sub ListBox1_Change()
With Me.ListBox1
If .ListIndex -1 Then
'MsgBox .List(.ListIndex, 1)
ThisWorkbook.FollowHyperlink _
Address:="Http://" & .List(.ListIndex, 1)
End If
End With
End Sub

Private Sub UserForm_Initialize()
Dim cell As Range
Dim sh As Worksheet

With Me
.ListBox1.RowSource = ""
.ListBox1.ColumnCount = 3
.ListBox1.Clear
End With

Set sh = Worksheets("Ark1")

For Each cell In sh.Range("A10:A250")
If cell.Value = sh.Range("A5").Value Then
With UserForm1
.ListBox1.AddItem cell.Value
.ListBox1.List(.ListBox1.ListCount - 1, 1) _
= cell.Offset(0, 2).Value
.ListBox1.List(.ListBox1.ListCount - 1, 2) _
= cell.Offset(0, 5).Value
End With
End If
Next

End Sub





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Colum heads in multcolumn listbox

column headings don't work unless you fill the listbox using rowsource.

--
Regards,
Tom Ogilvy

"Alen32" wrote in message
lkaboutsoftware.com...
I got here code which display multicolum list box. I would like to have
column heads in listbox. If it's possible my colum heads are in celle
F12:F14.

Option Explicit
Private Sub ListBox1_Change()
With Me.ListBox1
If .ListIndex -1 Then
'MsgBox .List(.ListIndex, 1)
ThisWorkbook.FollowHyperlink _
Address:="Http://" & .List(.ListIndex, 1)
End If
End With
End Sub

Private Sub UserForm_Initialize()
Dim cell As Range
Dim sh As Worksheet

With Me
.ListBox1.RowSource = ""
.ListBox1.ColumnCount = 3
.ListBox1.Clear
End With

Set sh = Worksheets("Ark1")

For Each cell In sh.Range("A10:A250")
If cell.Value = sh.Range("A5").Value Then
With UserForm1
.ListBox1.AddItem cell.Value
.ListBox1.List(.ListBox1.ListCount - 1, 1) _
= cell.Offset(0, 2).Value
.ListBox1.List(.ListBox1.ListCount - 1, 2) _
= cell.Offset(0, 5).Value
End With
End If
Next

End Sub







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
Keeping a sum colum correct after inserting a colum of data in fro hazel Excel Discussion (Misc queries) 3 October 19th 05 09:51 PM
Check data on colum A and find match on colum b Chris(new user) Excel Discussion (Misc queries) 3 March 20th 05 04:45 PM
Column Heads? Noggin[_3_] Excel Programming 1 July 4th 04 10:03 AM
heads of column (listbox in UF) Mark[_17_] Excel Programming 2 June 15th 04 06:56 AM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM


All times are GMT +1. The time now is 03:20 AM.

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

About Us

"It's about Microsoft Excel"