View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_4_] Don Guillett[_4_] is offline
external usenet poster
 
Posts: 2,337
Default Avoid printing blank columns

try this. modify to suit.

Sub hidecolsandprint()
For Each c In Range("a1:i1")
If Application.CountA(c.EntireColumn) = 0 Then _
c.EntireColumn.Hidden = True
Next
ActiveSheet.PrintPreview
Columns("a:i").Hidden = False
End Sub


--
Don Guillett
SalesAid Software

"Robbyn" wrote in message
...
Hi all! First time post to the newsgroup, but I've used the suggestions

posted here many, many times to help me with Excel troubles. I'm not a
programmer, but sometimes I copy and paste code to help me solve my
problems. Not sure if this is the proper newsgroup to introduce this
thread, so my apologies if it isn't.

I'm a teacher/tech coordinator and I'm trying to design a very

user-friendly gradesheet for teachers. I've modified a template downloaded
from Microsoft, and I would like to include a command button which produces
a printable page of everything EXCEPT blank columns in a certain range.

Gradesheet looks something like this:

A17-E17 includes Student names, Average, etc.

F17+ is comprised of assignments/tests

The # of columns with data will constantly be changing. Any help would be

appreciated.

BTW, excellent newsgroup. Thanks for ALL the help you've inadvertently

given me!