Mit veränderten Bereichen
Boris
Hi Stefano,
dann formatie manuell die Spalte B aus dem Blatt "Drucken" so, wie du es haben möchtest. Dazu diese beiden Codes:
Einfügen in das Klassenmodul "Drucken":
Option Explicit
Private Sub Worksheet_Activate()
Dim i As Integer
Range("B7:B60000").ClearContents
For i = 1 To ThisWorkbook.Sheets.Count
Cells(i + 6, 2) = Sheets(i).Name
Next i
End Sub
In ein allgemeines Modul:
Option Explicit
Sub drucken()
Const Ws_Druck As String = "Drucken"
Dim C As Range
Dim intRow As Integer
Dim strCheck As String
With Worksheets(Ws_Druck)
strCheck = MsgBox("Es werden insgesamt " & Application.Sum(.[c7:c30000]) & " Ausdrucke erstellt. Jetzt drucken?", vbYesNo, "Gebe bekannt...")
If strCheck = vbNo Then Exit Sub
On Error Resume Next 'quick and dirty
For intRow = 1 To ThisWorkbook.Sheets.Count
If .Cells(intRow + 6, 3) <> "" Then
Worksheets(CStr(.Cells(intRow + 6, 2))).PrintOut copies:=.Cells(intRow + 6, 3)
End If
Next intRow
On Error GoTo 0
End With
End Sub
Die Druckanzahl wird demnach in Spalte C eingegeben.
Grüße Boris