View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Hiding a From Button

Can you add another button that does the locking?

Option Explicit
Sub testme()

With ActiveSheet
If .ProtectContents = True _
Or .ProtectDrawingObjects _
Or .ProtectScenarios Then
'do nothing, already protected
Else
'sheet is unprotected, so hide buttons and protect it
.Buttons("button 1").Visible = False
.Buttons("button 2").Visible = False
.Buttons("button 3").Visible = False
.protect password:="YourPasswordHere"
End If
End With

End Sub



wrote:

I have a spreadsheet that has 7 different sheets. In each sheet there
are 6 From Buttons that activate Macro's. All the sheets are locked
with the exception of a few unprotected cells (where they can enter
there data). I've locked 3 of the Form Buttons so that you have to
unlock the sheet to use the buttons. Is there a way so that once I
lock the sheet the 3 From Buttons dissappear and when I unlock the
sheet they reappear? I'm not sure where to even start with this one.

Thanks,
Keith


--

Dave Peterson