Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Hide Unhide Picture And Cell Content Using CheckBoxes

  1. #11
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    You could protect the sheet while opening the workbook using the UserInterfaceOnly argument. And the VBA code will work as it is, and still not allow users to delete the picture or text. Of course the cells involved, and the pictures will have to have locked property.
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  2. #12
    Senior Member
    Join Date
    Jul 2013
    Posts
    102
    Rep Power
    12
    e
    Excel Fox
    Would you have that code to suit the worksheet with the picture and text
    Thanks

  3. #13
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    Just typing this on the fly... watch out for any typ0s

    Code:
    Sub Auto_Open()
    Dim wks as worksheet
    for each wks in thisworkbook.worksheets
    wks.Unprotect PassWord:=""' If there's a password, use it within the double quote
    wks.Protect UserInterfaceOnly:=True, Password=""' If there's a password, use it within the double quote
    next wks
    End Sub
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  4. #14
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    If you were just wanting to protect that particular sheet, then use

    Code:
    Sub Auto_Open()
    With Worksheets("Particular Sheet Name")
    .Unprotect PassWord:=""' If there's a password, use it within the double quote
    .Protect UserInterfaceOnly:=True, Password:=""' If there's a password, use it within the double quote
    End With
    End Sub
    EDIT: Added a semi-colon to the argument
    Last edited by Excel Fox; 08-03-2013 at 04:19 PM. Reason: Missed to add a semi-colon
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  5. #15
    Senior Member
    Join Date
    Jul 2013
    Posts
    102
    Rep Power
    12
    use the following code but get a error-expected named parameter

    Code:
    Sub Auto_Open()
    With Worksheets("sheet1")
    .Unprotect Password:="hello" ' If there's a password, use it within the double quote
    .Protect UserInterfaceOnly:=True, Password="hello"' If there's a password, use it within the double quote
    End With
    End Sub

  6. #16
    Senior Member
    Join Date
    Jul 2013
    Posts
    102
    Rep Power
    12
    I fixed a typo as you suggested so the code does not give error but it still allows me to delete the cell contents and it does not ask for passwords

    Thanks

  7. #17
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    I've made a small correction. Check my previous post.
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  8. #18
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    The code has to be pasted in a code module, and not in the sheet module or workbook module. Also ensure that the cell you're using is locked.
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

Similar Threads

  1. VBA To Hide And Unhide Rows
    By paul_pearson in forum Excel Help
    Replies: 10
    Last Post: 05-08-2013, 03:14 AM
  2. Hide/Unhide Columns with Listbox
    By obed_cruz in forum Excel Help
    Replies: 2
    Last Post: 05-28-2011, 07:26 PM
  3. Hide and Unhide Rows and Columns
    By Admin in forum Download Center
    Replies: 0
    Last Post: 05-11-2011, 12:00 AM
  4. Replies: 2
    Last Post: 05-06-2011, 02:59 AM

Posting Permissions

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