Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Dear experts,
I want to create a command button and when I click it, rows under row 30 will be collapsed. When I click the button again, it toggles to expand the rows under row 30. In the meantime, can the wording on the button be changed to "expand rows" in collapse status and "collapse rows" in expand status? Is it required a VBA code to operate? If yes, please kindly advise the code. Thanks in advance |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Something lik:
Sub HideRows() With Sheet1 Rows("30:65536").Select Selection.EntireRow.Hidden = True ActiveSheet.Shapes("CommandButton1").Select Sheet1.CommandButton1.Caption = "Expand Rows" End With End Sub Sub ShowRows() With Sheet1 Rows("30:65536").Select Selection.EntireRow.unHide = True ActiveSheet.Shapes("CommandButton1").Select Sheet1.CommandButton1.Caption = "Colapse Rows" End With End Sub Corey.... "Freshman" wrote in message ... Dear experts, I want to create a command button and when I click it, rows under row 30 will be collapsed. When I click the button again, it toggles to expand the rows under row 30. In the meantime, can the wording on the button be changed to "expand rows" in collapse status and "collapse rows" in expand status? Is it required a VBA code to operate? If yes, please kindly advise the code. Thanks in advance |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi Corey,
Thanks for your tip and it works great. Thanks once again. "Corey" wrote: Something lik: Sub HideRows() With Sheet1 Rows("30:65536").Select Selection.EntireRow.Hidden = True ActiveSheet.Shapes("CommandButton1").Select Sheet1.CommandButton1.Caption = "Expand Rows" End With End Sub Sub ShowRows() With Sheet1 Rows("30:65536").Select Selection.EntireRow.unHide = True ActiveSheet.Shapes("CommandButton1").Select Sheet1.CommandButton1.Caption = "Colapse Rows" End With End Sub Corey.... "Freshman" wrote in message ... Dear experts, I want to create a command button and when I click it, rows under row 30 will be collapsed. When I click the button again, it toggles to expand the rows under row 30. In the meantime, can the wording on the button be changed to "expand rows" in collapse status and "collapse rows" in expand status? Is it required a VBA code to operate? If yes, please kindly advise the code. Thanks in advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Command Button | Excel Worksheet Functions | |||
command button | Excel Worksheet Functions | |||
command button | Excel Discussion (Misc queries) | |||
Command button | Excel Discussion (Misc queries) | |||
Command Button | Excel Discussion (Misc queries) |