#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Hiding Rows

I'd like to have a toggle button on a sheet that
alternately hides and unhides a number of rows, say 5:10
Anyone know how?
I keep getting the error "Unable to set the Hidden
property of the range class"

The sheet is protected, userinterfaceonly:= true and
enableselection = xlunlocked cells

Many thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Hiding Rows

Try this

Sub test()
With ActiveSheet
If .Rows("5:10").EntireRow.Hidden = True Then
.Rows("5:10").EntireRow.Hidden = False
Else
.Rows("5:10").EntireRow.Hidden = True
End If
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"~Danny~" wrote in message ...
I'd like to have a toggle button on a sheet that
alternately hides and unhides a number of rows, say 5:10
Anyone know how?
I keep getting the error "Unable to set the Hidden
property of the range class"

The sheet is protected, userinterfaceonly:= true and
enableselection = xlunlocked cells

Many thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Hiding Rows

Private Sub CommandButton1_Click()
Me.Protect UserInterfaceOnly:=True
Me.EnableSelection = xlUnlockedCells
Rows("5:10").Hidden = Not Rows("5:10").Hidden
End Sub

worked fine for me in Excel 2000. If you have Excel 97, change the
takefocusonclick property to false.

--
Regards,
Tom Ogilvy

"~Danny~" wrote in message
...
I'd like to have a toggle button on a sheet that
alternately hides and unhides a number of rows, say 5:10
Anyone know how?
I keep getting the error "Unable to set the Hidden
property of the range class"

The sheet is protected, userinterfaceonly:= true and
enableselection = xlunlocked cells

Many thanks



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Hiding Rows

You may also need to unprotect/protect the sheet.

Sub test()
Worksheets(1).Unprotect
' Ron's code
Worksheets(1).Protect
End Sub

Ian

"Ron de Bruin" wrote in message
...
Try this

Sub test()
With ActiveSheet
If .Rows("5:10").EntireRow.Hidden = True Then
.Rows("5:10").EntireRow.Hidden = False
Else
.Rows("5:10").EntireRow.Hidden = True
End If
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"~Danny~" wrote in message

...
I'd like to have a toggle button on a sheet that
alternately hides and unhides a number of rows, say 5:10
Anyone know how?
I keep getting the error "Unable to set the Hidden
property of the range class"

The sheet is protected, userinterfaceonly:= true and
enableselection = xlunlocked cells

Many thanks





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Hiding Rows

The sheet is protected, userinterfaceonly:= true

The OP already protect it with userinterfaceonly:= true
The macro should run correct


--
Regards Ron de Bruin
http://www.rondebruin.nl


"IC" wrote in message ...
You may also need to unprotect/protect the sheet.

Sub test()
Worksheets(1).Unprotect
' Ron's code
Worksheets(1).Protect
End Sub

Ian

"Ron de Bruin" wrote in message
...
Try this

Sub test()
With ActiveSheet
If .Rows("5:10").EntireRow.Hidden = True Then
.Rows("5:10").EntireRow.Hidden = False
Else
.Rows("5:10").EntireRow.Hidden = True
End If
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"~Danny~" wrote in message

...
I'd like to have a toggle button on a sheet that
alternately hides and unhides a number of rows, say 5:10
Anyone know how?
I keep getting the error "Unable to set the Hidden
property of the range class"

The sheet is protected, userinterfaceonly:= true and
enableselection = xlunlocked cells

Many thanks







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 07:33 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"