#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default hiding rows

I have a sheet on which I wish to place a toggle button,
which when clicked hides all the rows except rows 5 to 14
and then when clicked again unhides all the hidden rows.

My code so far is

Private Sub togglebutton1_click()
select case togglebutton1
case true
rows("5:13").entirerow.hidden = true
case false
i don't know what to put here to unhide all hidden rows
end select

Even when I try the first bit I get a run time error.
This would be so useful and your help much appreciated.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 218
Default hiding rows

The following will hide all rows in the range of rows 1 to
100 EXCEPT Rows 5 to 14 when the toggle button is
depressed and unhide them when not depressed. Although
you said "hides all the rows except rows 5 to 14" I
assumed you didn't want to literally hide ALL the rows on
the worksheet (except 5 to 14) as there are 65536 rows and
this would look stupid.

Private Sub ToggleButton1_Click()
Rows("1:4").Hidden = ToggleButton1.Value
Rows("15:100").Hidden = ToggleButton1.Value
End Sub

Regards,
Greg


-----Original Message-----
I have a sheet on which I wish to place a toggle button,
which when clicked hides all the rows except rows 5 to 14
and then when clicked again unhides all the hidden rows.

My code so far is

Private Sub togglebutton1_click()
select case togglebutton1
case true
rows("5:13").entirerow.hidden = true
case false
i don't know what to put here to unhide all hidden rows
end select

Even when I try the first bit I get a run time error.
This would be so useful and your help much appreciated.


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default hiding rows

I have a sheet on which I wish to place a toggle button,
which when clicked hides all the rows except rows 5 to 14
and then when clicked again unhides all the hidden rows.

My code so far is

Private Sub togglebutton1_click()
select case togglebutton1
case true
rows("5:13").entirerow.hidden = true
case false
i don't know what to put here to unhide all hidden rows
end select

Even when I try the first bit I get a run time error.
This would be so useful and your help much appreciated.


try this:

Private Sub ToggleButton1_Click()
Rows.Hidden = False
If ToggleButton1.Value Then
Rows("1:4").Hidden = True
Rows("15:65536").Hidden = True
End If
End Sub

--
Regards

Melanie Breden
- Microsoft MVP für Excel -

http://excel.codebooks.de (Das Excel-VBA Codebook)

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
Color alternate rows when after hiding selected rows Monk[_2_] Excel Worksheet Functions 6 June 7th 08 01:36 AM
Hiding Specific Rows Based on Values in Other Rows Chris Excel Worksheet Functions 1 November 2nd 06 08:21 PM
Hiding a button when hiding rows fergusor Excel Discussion (Misc queries) 2 August 10th 06 02:31 PM
Hiding Rows if the linked rows are blank KG Excel Discussion (Misc queries) 9 May 18th 05 02:32 AM
Copying Rows when hiding other rows Neutron1871 Excel Worksheet Functions 2 November 3rd 04 11:38 PM


All times are GMT +1. The time now is 09:06 PM.

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

About Us

"It's about Microsoft Excel"