+ Reply to Thread
Results 1 to 9 of 9

Clear.Contents does not work when Password protected for sheet

  1. #1
    Registered User
    Join Date
    11-07-2013
    Location
    Virginia Beach, VA
    MS-Off Ver
    O365
    Posts
    19

    Clear.Contents does not work when Password protected for sheet

    Clear.Contents does not work when Password protected for sheet. Please help. Sheet's name is "Project SL Assessment Checklist".

    Please Login or Register  to view this content.

  2. #2
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Clear.Contents does not work when Password protected for sheet

    You need to unprotect the sheet before you clear the contents, then you can re-protect if you like.

    Like:
    Please Login or Register  to view this content.
    Remember, saying thanks only takes a second or two. Click the star icon(*) below the post you liked, to give some Rep if you think an answer deserves it.

    Please,mark your thread [SOLVED] if you received your answer.

  3. #3
    Registered User
    Join Date
    11-07-2013
    Location
    Virginia Beach, VA
    MS-Off Ver
    O365
    Posts
    19

    Re: Clear.Contents does not work when Password protected for sheet

    This worked fine on another sheet that was password protected with only one clear contents script. Why does adding another clear.contents line (two) require you to modify the code as such?

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,461

    Re: Clear.Contents does not work when Password protected for sheet

    Perhaps the cell is unlocked on one sheet and locked on the other.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Clear.Contents does not work when Password protected for sheet

    You can designate an area to allow edits when the sheet is protected. In general, the code can only clear or edit what the user can.

  6. #6
    Registered User
    Join Date
    11-07-2013
    Location
    Virginia Beach, VA
    MS-Off Ver
    O365
    Posts
    19

    Re: Clear.Contents does not work when Password protected for sheet

    I have the appropriate cells unlocked for their editing when protected. However, I think the issue may be because some of these cells (fields for input) are merged?

    How do you account for merged cells in clear contents? For example, the first "field" (H12:I12) is merged and the sheet contains various "fields" / merged cells on down to G42:J42.

    I assume there is a problem with the following? All cells in the merged range are unlocked.

    Please Login or Register  to view this content.
    Last edited by chparkervatech; 08-29-2016 at 04:49 PM.

  7. #7
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Clear.Contents does not work when Password protected for sheet

    This is where "does not work" is not good enough a description. What error do you get?

  8. #8
    Registered User
    Join Date
    11-07-2013
    Location
    Virginia Beach, VA
    MS-Off Ver
    O365
    Posts
    19

    Re: Clear.Contents does not work when Password protected for sheet

    Regardless, your solution worked. Thanks!

  9. #9
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Clear.Contents does not work when Password protected for sheet

    If you protect the sheet with VBA and use the parameter UserInterfaceOnly:=True, then you can write into protected cells, too. Whether or not cells are merged does not matter.

    The blue and the yellow cells in the screenshot are merged. All cells are locked.

    2016-08-30_9-04-38.gif
    Attached Images Attached Images
    Last edited by teylyn; 08-29-2016 at 05:05 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Error message when the work sheet is protected with password
    By thup_98 in forum Excel General
    Replies: 5
    Last Post: 02-21-2016, 04:10 AM
  2. clear contents of entire sheet except the contents of the table
    By wayneg in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-06-2015, 08:41 AM
  3. clear password protected combo
    By superchew in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-16-2013, 04:54 PM
  4. password protected hide sheet not work properle
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-30-2013, 09:40 AM
  5. Excel 2007 : Clear contents on all protected sheet
    By SEHRA in forum Excel General
    Replies: 0
    Last Post: 06-22-2011, 08:36 AM
  6. Clear sheet contents but retain Clipboard contents
    By nebb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-25-2007, 01:42 PM
  7. Clear Contents won't work on merged cells
    By ArthurJ in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-20-2006, 01:25 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1