Results 1 to 5 of 5

Thread: Clear protected cells

  1. #1
    VBAX Regular
    Joined
    Oct 2007
    Posts
    45
    Location

    Clear protected cells

    Hi,

    I've created some protection for my sheets with a password. The problem is that one of the instructions in the code is to clear the contents of some cells, but because they are protected, it gives me an error.
    Is there any way that i can protect my sheets so that anyone can change the cell's values, and be changed by visual basic code?

    thanks

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,455
    Location
    unprotect the sheet in code, change the cells, then re-protect.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Oct 2007
    Posts
    45
    Location
    Hi

    I've already remembered to do that, but i don't know how to do it....

    Can you help me please? It's protected with a password...


    Thank you soo much!

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,455
    Location
    [vba]

    Activesheet.Unprotect Password:="mypassword"

    'do your stuff

    Activesheet.Protect Password:="mypassword"
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Regular
    Joined
    Oct 2007
    Posts
    45
    Location

    Thumbs up

    Thank you very very much!!! Once more...

    Simple and effective!!!!

    Great!!

Posting Permissions

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