View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
kirkm[_6_] kirkm[_6_] is offline
external usenet poster
 
Posts: 156
Default List Box Row Source

On Thu, 8 Mar 2007 15:54:22 -0800, JLGWhiz
wrote:

Here is a snippet from VBA Help file:

Private Sub UserForm_Initialize()

ListBox1.ColumnCount = 5
ListBox1.RowSource = "a1:e4"
ListBox1.ControlSource = "a6"
'Place the ListIndex into cell a6
ListBox1.BoundColumn = 0
End Sub

Note that the RowSource is a simple five column range in quotes. You can
specify your range with single or multiple columns using RowSource so long as
the columuns are contiguous (side by side). Discontiguous columns must be
handled in an array.


Ok. Thanks. I can make them contiguous to start with.

Could you give me an example of ListIndex? I don't understand that.

Also - another problem. In the cells the numbers are formatted
correctly, but the listbox seems to overide that and present them
left justified. Can I resolve that - or should I use text mode and
leading spaces?

Thanks - Kirk



"kirkm" wrote:

Must the row source property be (e.g.) Reports!A1:D5 ?

Or can you specify individual columns like A1:A5, E1:E5, B1:B5

Thanks - Kirk