ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to print all columns from a multi column listbox? (https://www.excelbanter.com/excel-programming/441190-how-print-all-columns-multi-column-listbox.html)

Simon Lloyd[_1334_]

How to print all columns from a multi column listbox?
 

Hi all, i have a 4 column listbox on a userform populated like this:


VBA Code:
--------------------


With UserForm1.ListBox1
.AddItem rng.Address
.List(.ListCount - 1, 1) = rng.Offset(0, -29).Value
.List(.ListCount - 1, 2) = rng.Offset(0, -25).Value
.List(.ListCount - 1, 3) = rng.Offset(0, -24).Value
ic = ic + 1
End With
--------------------


i now want to print all 4 columns as seen in the listbox, could
someone explain how?


--
Simon Lloyd

Regards,
Simon Lloyd
'Excel Chat' (http://www.thecodecage.com/forumz/chat.php)
------------------------------------------------------------------------
Simon Lloyd's Profile: 1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=191929

http://www.thecodecage.com/forumz


Jim Cone[_2_]

How to print all columns from a multi column listbox?
 
Add a worksheet, write the list to the worksheet, print the worksheet, delete the worksheet.
--
Jim Cone
Portland, Oregon USA



"Simon Lloyd"
wrote in message ...

Hi all, i have a 4 column listbox on a userform populated like this:
VBA Code:
--------------------
With UserForm1.ListBox1
.AddItem rng.Address
.List(.ListCount - 1, 1) = rng.Offset(0, -29).Value
.List(.ListCount - 1, 2) = rng.Offset(0, -25).Value
.List(.ListCount - 1, 3) = rng.Offset(0, -24).Value
ic = ic + 1
End With
--------------------
i now want to print all 4 columns as seen in the listbox, could
someone explain how?
--
Simon Lloyd

Regards,
Simon Lloyd


Simon Lloyd[_1335_]

How to print all columns from a multi column listbox?
 

Jim, thanks for the reply, i did try as you suggested, however it
either only wrote the first value from the first column or wrote the
value of the selected item but not the corresponding data in the same
row in the other 3 columns.

Could you give an example please on writing the data eg. column 1 to
column A, column 2 to coulmn B...etc


Jim Cone;686899 Wrote:

Add a worksheet, write the list to the worksheet, print the worksheet,
delete the worksheet.
--
Jim Cone
Portland, Oregon USA



"Simon Lloyd"
wrote in message ...

Hi all, i have a 4 column listbox on a userform populated like this:
VBA Code:
--------------------
With UserForm1.ListBox1
.AddItem rng.Address
.List(.ListCount - 1, 1) = rng.Offset(0, -29).Value
.List(.ListCount - 1, 2) = rng.Offset(0, -25).Value
.List(.ListCount - 1, 3) = rng.Offset(0, -24).Value
ic = ic + 1
End With
--------------------
i now want to print all 4 columns as seen in the listbox, could
someone explain how?
--
Simon Lloyd

Regards,
Simon Lloyd


--
Simon Lloyd

Regards,
Simon Lloyd
'Excel Chat' (http://www.thecodecage.com/forumz/chat.php)
------------------------------------------------------------------------
Simon Lloyd's Profile: 1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=191929

http://www.thecodecage.com/forumz


Jim Cone[_2_]

How to print all columns from a multi column listbox?
 
Simon,

In the form module...
Worksheets("Sludge").Range("B2").Resize(ListBox1.L istCount - 1, ListBox1.ColumnCount).Value = ListBox1.List
--
Jim Cone
Portland, Oregon USA
(Special Sort... http://www.contextures.com/excel-sort-addin.html
30+ additional ways to sort)



"Simon Lloyd"
wrote in message ...
Jim, thanks for the reply, i did try as you suggested, however it
either only wrote the first value from the first column or wrote the
value of the selected item but not the corresponding data in the same
row in the other 3 columns.

Could you give an example please on writing the data eg. column 1 to
column A, column 2 to coulmn B...etc




Jim Cone;686899 Wrote:

Add a worksheet, write the list to the worksheet, print the worksheet,
delete the worksheet.
--
Jim Cone
Portland, Oregon USA



"Simon Lloyd"
wrote in message ...
Hi all, i have a 4 column listbox on a userform populated like this:
VBA Code:
--------------------
With UserForm1.ListBox1
AddItem rng.Address
List(.ListCount - 1, 1) = rng.Offset(0, -29).Value
List(.ListCount - 1, 2) = rng.Offset(0, -25).Value
List(.ListCount - 1, 3) = rng.Offset(0, -24).Value
ic = ic + 1
End With
--------------------
i now want to print all 4 columns as seen in the listbox, could
someone explain how?
--
Simon Lloyd

Regards,
Simon Lloyd


--
Simon Lloyd

Regards,
Simon Lloyd
'Excel Chat' (http://www.thecodecage.com/forumz/chat.php)
------------------------------------------------------------------------
Simon Lloyd's Profile: 1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=191929

http://www.thecodecage.com/forumz


Simon Lloyd[_1336_]

How to print all columns from a multi column listbox?
 

Thanks Jim worked a treat, i had previously tried something similar:
Sheets("PrintBox").Range("A1").Resize(ic, 4) = UserForm1.ListBox1

Where ic was an iteration count as items were added top the list but it
didn't perform, thanks for clearing that up!


Jim Cone;687240 Wrote:

Simon,

In the form module...
Worksheets("Sludge").Range("B2").Resize(ListBox1.L istCount - 1,
ListBox1.ColumnCount).Value = ListBox1.List
--
Jim Cone
Portland, Oregon USA
(Special Sort... 'Excel Sort Addin'
(http://www.contextures.com/excel-sort-addin.html)
30+ additional ways to sort)



"Simon Lloyd"
wrote in message ...
Jim, thanks for the reply, i did try as you suggested, however it
either only wrote the first value from the first column or wrote the
value of the selected item but not the corresponding data in the same
row in the other 3 columns.

Could you give an example please on writing the data eg. column 1 to
column A, column 2 to coulmn B...etc




Jim Cone;686899 Wrote:

Add a worksheet, write the list to the worksheet, print the worksheet,
delete the worksheet.
--
Jim Cone
Portland, Oregon USA



"Simon Lloyd"
wrote in message ...
Hi all, i have a 4 column listbox on a userform populated like this:
VBA Code:
--------------------
With UserForm1.ListBox1
AddItem rng.Address
List(.ListCount - 1, 1) = rng.Offset(0, -29).Value
List(.ListCount - 1, 2) = rng.Offset(0, -25).Value
List(.ListCount - 1, 3) = rng.Offset(0, -24).Value
ic = ic + 1
End With
--------------------
i now want to print all 4 columns as seen in the listbox, could
someone explain how?
--
Simon Lloyd

Regards,
Simon Lloyd


--
Simon Lloyd

Regards,
Simon Lloyd
'Excel Chat' (http://www.thecodecage.com/forumz/chat.php)
------------------------------------------------------------------------
Simon Lloyd's Profile: 1
View this thread: 'How to print all columns from a multi column
listbox? - The Code Cage Forums'
(http://www.thecodecage.com/forumz/sh...d.php?t=191929)

'Microsoft Office Help - Microsoft Office Discussion - Excel VBA
Programming - Access Programming' (http://www.thecodecage.com/forumz)


--
Simon Lloyd

Regards,
Simon Lloyd
'Excel Chat' (http://www.thecodecage.com/forumz/chat.php)
------------------------------------------------------------------------
Simon Lloyd's Profile: 1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=191929

http://www.thecodecage.com/forumz



All times are GMT +1. The time now is 08:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com