View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default hide unhide rows -Protected sheet

Private Sub CommandButton1_Click()
'hide rows
Dim myRng As Range

Set myRng = Me.Range("a32:a36")
me.unprotect 'Password:="Tada"
myRng.EntireRow.Hidden = Not (myRng(1).EntireRow.Hidden)
me.protect 'Password:="Tada"
--
HTH...

Jim Thomlinson


"Wanna Learn" wrote:

Hello I have a command button in a form
Private Sub CommandButton1_Click()
'hide rows
Dim myRng As Range

Set myRng = Me.Range("a32:a36")

myRng.EntireRow.Hidden = Not (myRng(1).EntireRow.Hidden)

but when I protect the form the button does not work. I also have the rows
and columns hidden
How can I correct this ?
thanks


End Sub