59 Aufrufe
Gefragt in Tabellenkalkulation von

Hallo Leute

Ich habe eine Excel Datei mit den Arbeitsblättern "Neu" und "Gebraucht".
Auf dem Arbeitsblatt "Neu" habe ich den Druckbutton. Ein Mauskolick drauf und das Arbeitsblatt wird ausgedruckt.
So weit alles gut,

Nun möchte ich aber, dass nachdem Mausklick auch das Arbeitsblatt "gebraucht" ausgedruckt wird. 
Wie kann ich das bewerkstelligen? Hat wohl mir der Variabkendeklaration und mt dem Print Befehl zu tun. Momentan heisst es.
Sub DruckenNeu
ThisWorkbook.Worksheets(wksh_Neu).Activate
 Application.Dialogs(xlDialogPrinterSetup).Show
    ActiveSheet.PrintOut From:=1, To:=1
 End Sub

Ichhabe folgendes versucht, was aber nicht funktioniert
Sub DruckenNeu
ThisWorkbook.Worksheets(wksh_Neu).Activate
 Application.Dialogs(xlDialogPrinterSetup).Show
    ActiveSheet.PrintOut From:=1, To:=1
 End Sub


Sub DruckenGebraucht
ThisWorkbook.Worksheets(wksh_gebraucht).Activate
 Application.Dialogs(xlDialogPrinterSetup).Show
    ActiveSheet.PrintOut From:=1, To:=1
 End Sub


Wer möchte mir helfen?
Gruss H

1 Antwort

0 Punkte
Beantwortet von xlking Experte (1.8k Punkte)

Hi,

ich habe keinen Drucker, deshalb ungetestet. Probiers mal so:

Sub DruckenNeu()

Dim wsh As Worksheet

Application.Dialogs(xlDialogPrinterSetup).Show

For Each wsh In ThisWorkbook.Worksheets
  wsh.PrintOut From:=1, To:=1
Next wsh

End Sub

Gruß Mr. K.

...