Hello all,
I have the following macro on a button which was bringing up the choose printer dialog then printing when printer chosen, however now it is printing on the last printer used and then bringing up the dialog. How can I correct this?
I want to press the button, choose the printer, then print. It only prints sheets that have "YES" in cell E1.
Sub PrintSheets()Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If UCase(ws.Range("E1")) = "YES" Then ws.PrintOut
Next ws
Application.Dialogs(xlDialogPrinterSetup).Show
End Sub
I also want to add this formula, which puts the value in A2 in the header. How can I build this into the code above?
Sub UpdateHeader()ActiveSheet.PageSetup.CenterHeader = Range("A2").Value
End Sub
What I ideally want is it to put the value from Sheet'Menu' Range A2 into the header of all sheets. I've also noticed that if something in A2 changes, the macro doesn't replace a previous entry, it keeps it and writes over it. Is there a way to get it to clear the header before running this bit of code - so it has a blank canvas.
Any advice appreciated!
Cheers
Luke
Bookmarks