Hi, I am writing a macro to expand/collapse a group of rows.
Requirement:
The excel sheet contains test cases. The test cases are grouped into
different categories. For easy viewing of the test cases, I need to
collapse the entire category of test cases. The category name comes
first on a separate row followed by several rows of test cases - test
cases can be any number and people can keep on adding/removing cases.
I have put small buttons with names ' ', '-' and mapped to macros to
hide and unhide rows. This works well (See macros HideR, UnhideR below)
The problem:
I dont want to hardcode the row numbers as the row numbers can keep on
changing. I am mainly creating a test cases template which will be used
by others. They should not go about editing macros. Their job is just
to add/modify test cases and the , - buttons should still work.
I have thought of the following solution, but I am not sure how to go
about implementing this and need help here.
The macro could collapse all the rows from the current row/cell (where
the buttons are located) until a fixed pattern is matched (say, quot;END
SECTIONquot;). The buttons can then be placed on the same row as the
category header. At the end of the section the quot;END SECTIONquot; will be
placed. Rows can be added/deleted in between and the macros would still
work. Is this possible?
cheers,
Girish----------------------------------------------------------------------------------
Sub HideR()
Rows(quot;6:13quot;).Select
Selection.EntireRow.Hidden = True
End Sub
Sub UnhideR()
Rows(quot;6:13quot;).Select
Selection.EntireRow.Hidden = False
End Sub
----------------------------------------------------------------------------------
- Oct 22 Sun 2006 20:10
Expand/Collapse Rows
close
全站熱搜
留言列表
發表留言