Listbox printing and converting to PDF FİLE...

asyamonique

Well-known Member
Joined
Jan 29, 2008
Messages
1,280
Office Version
  1. 2013
Platform
  1. Windows
Good Day,
Is it possible to print datas with calculation?
I have huge of datas which located between the columns A:F
And listing with a code given below...

Code:
Application.ScreenUpdating = FalseDim a, i As Long, ii As Long, b(), n As Long
ListBox1.Clear
With ComboBox4
If .Text = "" Then Exit Sub
If WorksheetFunction.CountIf(Worksheets("IN").Range("a:a"), .Text) = 0 Then
Exit Sub
End If
a = Worksheets("IN").Range("a1").Resize(Worksheets("IN").Range("a" & Rows.Count).End(xlUp).Row, 6).Value
For i = 1 To UBound(a, 1)
If a(i, 1) = .Text Then
n = n + 1: ReDim Preserve b(1 To 11, 1 To n)
For ii = 1 To UBound(a, 2)
b(ii, n) = a(i, ii)
Next
b(5, n) = Format$(a(i, 5), "dd-mmm-yyyy")
End If
Next
End With
With ListBox1
.ColumnCount = 6
.ColumnWidths = "100;100;100;100;100;0"
.Column = b
End With
With Application
Me.TextBox9.Value = .Sum(.Index(b, 3, 0))
TextBox9.Text = Format(TextBox9.Text, "###,##0.00")
End With
Application.ScreenUpdating = True


I've put a command button near listbox for printing with below code and it works ok but without giving sum value for column"C" which textbox9 value..


Code:
Dim ws As WorksheetDim rng As Range
Dim i As Long
Dim J As Long


Set ws = Worksheets.Add
Set rng = ws.Range("A1")
For i = 0 To ListBox1.ColumnCount - 1
For J = 0 To ListBox1.ListCount - 1
rng.Offset(J, i) = ListBox1.Column(i, J)
Next J
Next i
Columns("A:A").Resize(, ListBox1.ColumnCount).EntireColumn.AutoFit
Application.DisplayAlerts = False
ws.PageSetup.Orientation = xlPortrait
ws.PrintOut
ws.Delete
Application.DisplayAlerts = True

My question is how can I print that datas with taking textbox9 value(sum result of column c)?
Also is there anyway to save that listbox datas as pdf file?
Many thanks
 
Last edited:

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Forum statistics

Threads
1,215,143
Messages
6,123,285
Members
449,094
Latest member
GoToLeep

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