Hide individual/range cells and temporarily increase scale for printing

C

chris100

Hi all,

Very new to VB and macros in excel. First what i'm working on. This is
a basic macro in an invoice that will print 3 pages - two customer copy
and a driver copy.

i would like to have two different headings at the top printed in a
cell - i.e "customer copy" and "Delivery Note".

Either i can have the two headings written in two cells as headers. One
hidden and then printed then hide this and display and print with the
other cell heading.

Or i can have one cell which can have a custom headings printed and
just changes after each print.

I think the second method would be more efficient but i'd also like to
know how to hide a cell.

Remember i'm very much a newb to this sort of thing so please go easy
on me...

Below i include the basics of what i'm using already:

Sub HideAndPrint()
Application.ScreenUpdating = False
Columns("B").Hidden = True
ActiveSheet.PrintOut Copies:=2
Columns("B").Hidden = False
Application.ScreenUpdating = True
Application.ScreenUpdating = False
Columns("B").Hidden = True
ActiveSheet.PrintOut Copies:=1
Columns("B").Hidden = False
End Sub

I've deleted a few lines to keep in shorter but the basic principle is
there.

Thanks for any help!
 
C

chris100

I also to forgot to mention that when the previous macro is run, hiding
the columns obviously makes what is displayed on the page less than the
previous version.

As one copy is for a driver and loader, i'd like to increase the scale
of the page so that he/she can more easily read the order.
 
D

Dave Peterson

You could also do the equivalent of File|page setup|Header/footer tab and change
the header, print, change the header, and print again...

But if you want to change cells:

Sub HideAndPrint()

Application.ScreenUpdating = False

Columns("B").Hidden = True
range("a1").value = "Customer Copy"
ActiveSheet.PrintOut Copies:=2

Columns("B").Hidden = False 'which one here???
Columns("B").Hidden = True
range("a1").value = "Driver Copy"
ActiveSheet.PrintOut Copies:=1

Columns("B").Hidden = False
range("a1").value = "" 'or whatever you want.

Application.ScreenUpdating = True

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top