وعليكم السلام ورحمة الله وبركاتة
كود طباعة الكل
Sub PrintAll()
Dim ws As Worksheet
Dim dropdownCell As Range
Dim validationFormula As String
Dim optionsRange As Range
Dim cell As Range
Dim originalValue As Variant
Dim counter As Integer
Set ws = ActiveSheet
Set dropdownCell = ws.Range("D4")
originalValue = dropdownCell.Value
If dropdownCell.Validation.Type = 3 Then
validationFormula = dropdownCell.Validation.Formula1
If Left(validationFormula, 1) = "=" Then
validationFormula = Mid(validationFormula, 2)
End If
Set optionsRange = ws.Range(validationFormula)
counter = 0
For Each cell In optionsRange
If cell.Value <> "" Then
dropdownCell.Value = cell.Value
Application.Calculate
DoEvents
ws.PageSetup.PrintArea = "C3:J54"
ws.PrintOut
counter = counter + 1
Application.StatusBar = "تم طباعة " & counter & " من " & optionsRange.Cells.Count
End If
Next cell
dropdownCell.Value = originalValue
Application.StatusBar = ""
MsgBox "تمت طباعة " & counter & " عنصر بنجاح!", vbInformation
Else
End If
End Sub
مرتبات شركة نقل البضائع فنيين عن شهر نوفمبر 2025.xlsm