Print data from listbox in userform vba

inactiveUser214710

Board Regular
Joined
Apr 27, 2012
Messages
171
I am unable to solve this.
I have a Userform (usrf1), that has a combobox (cbo1), a listbox (lstPed) and commadButton (cmdPrint).
The Listbox have three columns, which are fills up in by order of (cbo1).
And my goal is print it to an other sheet (Sheet6) with head colums (A1 to C3).
So the information must go to (A3 to C30) and after that I can printout.
I used :
VBA Code:
''''Dim arr As Variant
''''
''''With usrf1.lstPed
''''arr = Application.Transpose(usrf1.lstPed.List)
'''''    Sheets("Sheet6").Range("a3").Resize(.ListCount).Value = .List
''''End With
'''''Sheets("sheet6").Range("a3").CurrentRegion.PrintOut
'''''End Sub

But I don´t know how to change for acept the three columns
Could anyone help me, I will be grateful. thank you
Jdcar
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
VBA Code:
Private sub PrinterList ()
Dim arr As Variant

With UserForm9.lstPed
arr = Application.Transpose(UserForm9.lstPed.List)
    Sheets("Sheet1").Range("a1").Resize(.ListCount).Value = .List
End With
Sheets("sheet1").Range("a1").CurrentRegion.PrintOut
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,491
Messages
6,113,963
Members
448,536
Latest member
CantExcel123

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top