Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
ListBox
"Seth" wrote in message
... I have a listbox control with columnheaders. How can I, at run time, get the values of these headers (if possible)? Hi Seth, The easiest way to do this is to read the RowSource property of the ListBox, convert it into a Range object, then get the row directly above it, which contains the headers. Here's an example of how this would work: Private Sub CommandButton1_Click() Dim rngCell As Range Dim rngHeaders As Range Set rngHeaders = Application.Range(ListBox1.RowSource) _ .Offset(-1, 0).Resize(1) For Each rngCell In rngHeaders MsgBox rngCell.Value Next rngCell End Sub -- Rob Bovey, MCSE, MCSD, Excel MVP Application Professionals http://www.appspro.com/ * Please post all replies to this newsgroup * * I delete all unsolicited e-mail responses * |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Listbox 2 takes the value of Listbox 1 | Excel Discussion (Misc queries) | |||
listbox B conditional of input in Listbox A | Excel Discussion (Misc queries) | |||
Listbox B if LIstbox A equals | Excel Discussion (Misc queries) | |||
ListBox (maybe?) ... If so, how? | Excel Discussion (Misc queries) | |||
Sorting ListBox results or transposing ListBox values to other cells for sorting | Excel Programming |