A
asawyer
I'm trying to populate a listbox with VBA.
I can't figure out a way to get column headings.
This is my code.
With UserForm1.ListBox1
.ColumnCount = 2
.RowSource = ""
.ColumnHeads = True
.Enabled = True
.ColumnWidths = "70 pt;100 pt"
End With
With UserForm1.ListBox1
.AddItem
.List(.ListCount - 1, 0) = "test1"
.List(.ListCount - 1, 1) = "test2"
.AddItem
.List(.ListCount - 1, 0) = "test1"
.List(.ListCount - 1, 1) = "test2"
' Etc, etc
End With
It loads the values but I can't get headings.
I want to do this in code, as the headings I want are "Date","Amount" but
they don't exist anywhere on my workbook at this point.
Thanks in advance,
Alan Sawyer
I can't figure out a way to get column headings.
This is my code.
With UserForm1.ListBox1
.ColumnCount = 2
.RowSource = ""
.ColumnHeads = True
.Enabled = True
.ColumnWidths = "70 pt;100 pt"
End With
With UserForm1.ListBox1
.AddItem
.List(.ListCount - 1, 0) = "test1"
.List(.ListCount - 1, 1) = "test2"
.AddItem
.List(.ListCount - 1, 0) = "test1"
.List(.ListCount - 1, 1) = "test2"
' Etc, etc
End With
It loads the values but I can't get headings.
I want to do this in code, as the headings I want are "Date","Amount" but
they don't exist anywhere on my workbook at this point.
Thanks in advance,
Alan Sawyer