There is another way to achieve this: -
Private Sub UserForm_Initialize() Dim list As Object Set list = UserForm1.Controls.Add("Forms.ListBox.1", "hello", True) With list .Top = 30 .Left = 30 .Width = 200 .Height = 340 .ColumnHeads = True .ColumnCount = 2 .ColumnWidths = "100;100" .MultiSelect = fmMultiSelectExtended .RowSource = "Sheet1!C4:D25" End With End Sub
Here I use the C4: D25 range as a data source for columns. This will cause both columns to be filled with values.
The properties are self-evident. You can explore other parameters by using DrawBox in UserForm and using the "properties window (F4)" to play with the parameters.
srikanth sharma
source share