View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default URGENT!! Use macro button to hide empty columns and rows...HELP!!!!

Hi Hawk,

Some questions:

(1) If each employee column is for data entry, with calculations being
effected on the report sheet, why are there formulas in the employee column?

(2)Are the columns which are not 'empty' (i.e. have data entered)
contiguous?

(3) Does each non-empty employee column neccessarily have data in a given
row, such row otherwise being completely empty (no data, nor formula)?

For your Report sheet, you can autofilter, setting a custom filter criterion
for column A to Not equal to 0. This will hide the rows that you do not wish
to print.

---
Regards,
Norman



"Hawk" wrote in message
ups.com...
Can anyone provide help with a time sensitive request?? Before I
begin, I have to say that I am an Accountant, not a programmer, so
please keep that in mind if/when you respond...

I have a workbook that contains two worksheets. One is a data entry
sheet that users will input employee data into and the other sheet is
the actual report that contains all formulas that pull info from the
data entry page. On the data entry page, the sheet begins with 30
columns that the user will input employee information into. One column
represents one employee. However, all 30 columns are not always
needed. I would like to create a macro (with a button) that will hide
the empty columns just for the purposes of printing the document so
that empty columns are not printed on the page. (Note: The empty
columns do contain formulas.)

I've searched for solutions on the web and I've come up with the
following, however, when I run the macro all 30 columns get hidden even
if there is data in them:

Sub Hide_EmptyColumns()
'To hide columns with no data in rows 10:82
Sheets("Box").Select
Dim col As Range
For Each col In Columns("C:AF")
If Application.Count(Range(Cells(4, col.Column), Cells(8, col.Column)))
= 0 Then
col.Hidden = True
End If
Next
End Sub

Also, all the data entered on the data entry page links to another
sheet, which is the report. However, the report contains employee
information in the rows, instead of columns. So, one row represents an
employee. I need a macro (with a button) that will hide the empty rows
for printing purposes so that blank rows will not appear on the report.
The only problem is that there is a formula in EVERY cell on the
report. So I need something that will look at column "A" and if the
formula result is "0" it will hide the entire row. I don't have a
possible solution for this one because I'm stuck on the first problem.

I really hope that I was clear. Anyone's help would be greatly
appreciated. I really need to have this done by tomorrow, if possible.
THANK YOU!!!