Printing non-adjacent columns

  • Thread starter Thread starter Ann Shaw
  • Start date Start date
A

Ann Shaw

Hi

I know I can hide columns I don't want to print and I know
I can use Group and Outline but that means I have to do
this each time to the columns I want to print and they
could be different each time in the spreadsheet - is there
a quicker way using a macro or something?

Basically I have 45 columns and sometimes I want to print
for example A:E,G,M-P,T and sometimes I want to print
other combinations of columns.

Thanks

Ann
 
Record a macro when you hide your columns, print the worksheet, and unhide the
columns.

Then you could use that as the basis of your code to print the columns you need
to print.

This is what I ended up with (printpreview, though):

Option Explicit
Sub testme()
Dim myRng As Range
With ActiveSheet
Set myRng = .Range("A:E,G:G,M:P,T:T")
.UsedRange.Columns.Hidden = True
myRng.EntireColumn.Hidden = False
.PrintOut preview:=True
.UsedRange.Columns.Hidden = False
End With
End Sub

You could even add some buttons to the worksheet that were assigned to the
different "prints".
 

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

Back
Top