Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Hide rows to create summary

We have a program that dumps data into XLS. There are two end-user
requirements for the output. One requirement is essentially a
shortened version of the other.

To ensure that the full data set is always present it struck me that I
should be able to hide rows to create the summary. The default
version of the output will be the "short" version. The idea is that
the "expert" version would become available by unhiding the lines.

I have seen samples of code

http://www.vbaexpress.com/kb/getarticle.php?kb_id=416

with expressions like

Rows(4).EntireRow.Hidden = True

What is the simplest way to hide a mix of contiguous and contiguous
lines? ie. Hide lines 3-4, 6 ,8-22, 25 and 31. There might be 100
hidden lines in total. Does each line have to be hidden individually
or can the be treated as groups?

My VBA skills are definitely in the beginner category!

Steve



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Hide rows to create summary

You can do it with a single statement, but you must show a colon delimited
start and end row for each entry in the list (just use the same start and
end row for single row items (for example, your single Row 6 item would be
shown as 6:6)...

Range("3:4,6:6,8:22,25:25,31:31").EntireRow.Hidden = False

--
Rick (MVP - Excel)


"SteveG31530" wrote in message
...
We have a program that dumps data into XLS. There are two end-user
requirements for the output. One requirement is essentially a
shortened version of the other.

To ensure that the full data set is always present it struck me that I
should be able to hide rows to create the summary. The default
version of the output will be the "short" version. The idea is that
the "expert" version would become available by unhiding the lines.

I have seen samples of code

http://www.vbaexpress.com/kb/getarticle.php?kb_id=416

with expressions like

Rows(4).EntireRow.Hidden = True

What is the simplest way to hide a mix of contiguous and contiguous
lines? ie. Hide lines 3-4, 6 ,8-22, 25 and 31. There might be 100
hidden lines in total. Does each line have to be hidden individually
or can the be treated as groups?

My VBA skills are definitely in the beginner category!

Steve




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Hide rows to create summary

This works really well!

Is there a way to trigger the macro when the .xls is opened?

Thanks

Steve

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Hide rows to create summary

I see you worked through my accidentally using False instead of True in the
statement (I reset the visibility of the rows and then accidentally copied
that statement by mistake).

As for your question, I guess you can use the workbook's Open event to do
that. Right click the small icon to the left of the word File in Excel's
menu bar (this takes you to the code window for the Workbook) and copy paste
the following into the code window that opens up...

Private Sub Workbook_Open()
Range("3:4,6:6,8:22,25:25,31:31").EntireRow.Hidden = True
End Sub

--
Rick (MVP - Excel)


"SteveG31530" wrote in message
...
This works really well!

Is there a way to trigger the macro when the .xls is opened?

Thanks

Steve


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Hide rows to create summary

This is even better.

Now we have two end-users satisfied with one output.

Many thanks

Steve


Reply
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
create a summary page that will take a list and remove empty rows Dematic slave Excel Discussion (Misc queries) 3 September 19th 08 12:15 AM
Summary sheet/ hide rows Sally in Toronto Excel Worksheet Functions 2 November 23rd 06 03:23 AM
Create Summary WB GregR Excel Programming 2 April 25th 06 07:39 PM
how to create a formula to hide specific rows after meeting requi DNelson New Users to Excel 2 February 7th 06 01:06 PM
Can you create a macro to hide rows with zero values? natrujillo12 Excel Programming 1 September 28th 05 08:09 PM


All times are GMT +1. The time now is 02:17 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"