LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 611
Default spreadsheet to report

Joanne,

Since you want all the rows of one sheet (but only one of the Level columns), Autofilter
will not be useful. It hides rows that you don't want, but doesn't hide columns.

If you want to automate the process of hiding all but one of the Level columns, do this:

Press Alt-F11. This will take you to the VBE.
View - Project Explorer (to ensure the Project Explorer pane is visible).
Find your project (your workbook) in the Project Explorer.
Right-click anywhere in it, and choose Insert - Module.
Copy the following and paste it into the new module four times.

Sub Level1()
' Hides all but the desired Level column.
Dim i As Integer
Const LevelColumnFirst = 3 ' column of first Level column
Const LevelColumnsCount = 4 ' count of Level columns
Const Level = 1 ' level to be not hidden (for printing)

For i = LevelColumnFirst To LevelColumnFirst + LevelColumnsCount - 1
If i - LevelColumnFirst + 1 = Level Then ' is this the level we want
Cells(1, i).EntireColumn.Hidden = False ' yes, unhide it
Else
Cells(1, i).EntireColumn.Hidden = True ' no, hide it
End If
Next i
End Sub

In the second one, change Level1 to Level2, and change Const Level to 2. Repeat for the
third and fourth subs, setting them to 3 and 4 respetively. Ensure that LevelColumnFirst is
in fact column 3 (the Level 1 column) in your sheets, and if not, change it accordingly.

Copy/Paste this to the end of the module:

Sub LevelsAll()
' Unhides all the levels columns
Dim i As Integer
Const LevelColumnFirst = 3 ' column of first Level column
Const LevelColumnsCount = 4 ' count of Level columns
For i = LevelColumnFirst To LevelColumnFirst + LevelColumnsCount - 1
Cells(1, i).EntireColumn.Hidden = False
Next i
End Sub

Now Alt-Tab back to Excel. Use Tools - Macro - Macros to run each to see if it works. If
they do, you can set up buttons to click or keyboard shortcuts to press to start the macros.
Post back for more on that.
--
Earl Kiosterud
www.smokeylake.com
-----------------------------------------------------------------------
"Joanne" wrote in message
...
Thanks for your time in considering my problem

I read the article at smokeylake. In fact, I read them all - very
interesting and informational.

In this particular case, being on separate sheets is okay as I will only
be using one sheet for each particular instance of the job.

I was thinking after reading your post and the above information that
maybe running autofilter on the active sheet to hide what I don't want
in the report could work, then select the rest of the sheet, copy it and
drop it on my template and print it out to present to the customer.

I would want to choose only the body of the report, not titles and there
will be no totals, then hid all of the 'level' columns I don't need;
then drop my selections onto a template (form) created just for this
process, print it and be done. I don't know much about autofilter, but I
sure can read up on it to see how this works. Then I could use a macro
or some lite ;-) coding to automate the process as much as possible if
necessary.

Any suggestions where to start reading about auto filter would be very
helpful

Thanks again Earl
Joanne
Earl Kiosterud wrote:

and consider it carefully (try to resist rejecting
it out of hand). This won't address selecting the Level, but that could be done with a
button-driven macro that simply hides the unwanted level columns.

You don't say how you want the data presented. If it could be temporarily in the same
sheet, perhaps long enough to print or copy somewhere, this would work well. If you need
the output to exist separately from the original data, then it will probably require an
Advanced Filter or something, which would have to be driven by a macro if it's to be
automated. Say more about the presentation of the output. And thow in where the desired
parameters (Level, and sheet desired) will be.




 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How To Print Spreadsheet Report using VBA Code [email protected] Excel Discussion (Misc queries) 1 September 4th 06 07:01 PM
Convert excel spreadsheet into crystal report joala Excel Worksheet Functions 1 March 30th 06 09:50 PM
Spreadsheet Summary Report JerryS Excel Worksheet Functions 1 February 4th 06 10:41 PM
Take info on spreadsheet and turn it in a report andreah Excel Discussion (Misc queries) 1 August 25th 05 05:45 PM
How do I put a button on an excel spreadsheet to print a report? Casper Excel Discussion (Misc queries) 2 July 28th 05 03:21 AM


All times are GMT +1. The time now is 07:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"