asyamonique
Well-known Member
- Joined
- Jan 29, 2008
- Messages
- 1,286
- Office Version
- 2013
- Platform
- 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...
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..
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
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: