how to make
Eliminate Pivot Table Annoyances
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 6 of 6

Thread: how to make

  1. #1
    New Member
    Join Date
    Feb 2002
    Posts
    18
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    a button so that when it is [ress it will protect the sheet, and press again to unprotect the sheet?
    also is it possible so that after the sheet is protected the button text will say "click unprotect sheet" and when it is pressed again it will say " click to protect sheet"

  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Sydney, Australia
    Posts
    2,936
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi,

    If you place the commandbutton on your sheet and change it's caption to Click to Protect Sheet. Then double click the button and use this code:-

    Code:
    Private Sub CommandButton1_Click()
    If Me.CommandButton1.Caption = "Click to protect sheet" Then
        Me.Protect "passwordIfyouwant"
        Me.CommandButton1.Caption = "Click to unprotect sheet"
    Else
        Me.Unprotect "passwordIfyouwant"
        Me.CommandButton1.Caption = "Click to protect sheet"
    End If
    End Sub
    HTH,
    D

    [ This Message was edited by: dk on 2002-02-25 07:18 ]

    [ This Message was edited by: dk on 2002-02-25 07:19 ]

  3. #3
    Guest

    Default

    When I try this I get runtime error 1004

    How can I fix it?

  4. #4
    New Member
    Join Date
    Feb 2002
    Posts
    18
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    didn't work, it says "invaild use of Me keyword" ;/

  5. #5
    New Member
    Join Date
    Feb 2002
    Posts
    18
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    *bump*

  6. #6
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Sydney, Australia
    Posts
    2,936
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Are you using the command button from View, Toolbars, Control Toolbox? If you place that button on the sheet and make sure you're in Design mode (the blue set square icon on the Control Toolbox is pressed in). Now double click the button. It will take you to the code module of the button's parent - in this case the sheet code module. Put the code there - not in a standard module.

    Any more problems, let me know,

    Regards,
    D

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com