ارجو من استاذنا الفاضل / ضاحى الغريب شرح كود الطباعة لبرنامج الايجارات
لقلة معرفتى بكود الطباعة
تحياتى لاستاذنا الغالى
[Sub Tenants_LstAdaMPrint()
Set Frm = Tenants
Sheet6.Visible = True
Set SH = Sheet6
Application.Visible = True
With SH
.Activate
For mm = 0 To Frm.LstAdaM.ListCount
Dim Last As Long
Rows("5:5").Hidden = False
Last = Range("b" & Rows.Count).End(xlUp).Row + 1 + mm
On Error Resume Next
With Rows(Last)
.FillDown
.SpecialCells(xlConstants).ClearContents
End With
On Error GoTo 0
Next
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
LsRow = .Cells(Rows.Count, "b").End(xlUp).Row + 1
On Error Resume Next
For AA = 0 To Frm.LstAdaM.ListCount
.Cells(AA + LsRow, 2) = Frm.LstAdaM.Column(5, AA)
.Cells(AA + LsRow, 4) = Frm.LstAdaM.Column(3, AA)
.Cells(AA + LsRow, 5) = Frm.LstAdaM.Column(1, AA)
Next:
'"""""""""""""""""""""""""""""""""""""""""""""""""""""""
LR = .Cells(Rows.Count, "b").End(xlUp).Row
.Cells(LR + 1, 5) = Frm.T_Total1.Value: .Cells(LR + 1, 2) = "الـمجمـوع "
'.Cells(LR + 1, 6) = Frm.Paid.Value
'.Cells(LR + 1, 7) = Frm.T_Total1.Value
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Rows("5:5").Hidden = True
ER = WorksheetFunction.CountA(Range("A:E")) + 1
RR = .Cells(.Rows.Count, "A").End(xlUp).Row
RN = "A1:E" & ER
.[A3].Value = Frm.Lb_Information.Caption
Tenants.Hide
.Range(RN).PrintOut Copies:=1, Preview:=True, Collate:=True
.Range("A6:E" & Rows.Count).Clear: .[A3].Value = ""
Sheet6.Visible = False
Sheet1.Activate
Application.Visible = False
Tenants.Show
End With: End Sub