Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
print listbox contents
Maybe just loop through the contents (write to a temporary worksheet) and then
print that: Option Explicit Private Sub CommandButton1_Click() Dim i As Long Dim j As Long For i = 0 To Me.ListBox1.ListCount - 1 For j = 0 To Me.ListBox1.ColumnCount - 1 MsgBox Me.ListBox1.List(i, j) Next j Next i End Sub Private Sub UserForm_Initialize() Dim i As Long Dim j As Long With Me.ListBox1 .ColumnCount = 10 .ColumnWidths = 0.3 For i = 1 To 5 .AddItem Worksheets("sheet1").Cells(i, "A").Value For j = 1 To 9 .List(.ListCount - 1, j) _ = Worksheets("sheet1").Cells(i, "A").Offset(0, j).Value Next j Next i End With End Sub GUS wrote: How can i print th contents of a listbox with 10 columns ? -- Dave Peterson |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
print listbox contents
I like Tom's answer to your later post better than the looping I did.
Dave Peterson wrote: Maybe just loop through the contents (write to a temporary worksheet) and then print that: Option Explicit Private Sub CommandButton1_Click() Dim i As Long Dim j As Long For i = 0 To Me.ListBox1.ListCount - 1 For j = 0 To Me.ListBox1.ColumnCount - 1 MsgBox Me.ListBox1.List(i, j) Next j Next i End Sub Private Sub UserForm_Initialize() Dim i As Long Dim j As Long With Me.ListBox1 .ColumnCount = 10 .ColumnWidths = 0.3 For i = 1 To 5 .AddItem Worksheets("sheet1").Cells(i, "A").Value For j = 1 To 9 .List(.ListCount - 1, j) _ = Worksheets("sheet1").Cells(i, "A").Offset(0, j).Value Next j Next i End With End Sub GUS wrote: How can i print th contents of a listbox with 10 columns ? -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
copying the contents of a drop down list from the listbox itself? | Excel Discussion (Misc queries) | |||
how do you print the contents of only one cell | New Users to Excel | |||
listbox B conditional of input in Listbox A | Excel Discussion (Misc queries) | |||
contents of cells do not print | Excel Worksheet Functions | |||
Copying contents of a listbox | Excel Programming |