+ Reply to Thread
Results 1 to 3 of 3

After Worksheet Protect/Unprotect selection of cells deletes contents?

  1. #1
    Registered User
    Join Date
    10-01-2010
    Location
    Doncaster, England
    MS-Off Ver
    Excel 2003
    Posts
    10

    After Worksheet Protect/Unprotect selection of cells deletes contents?

    Good morning all,

    I have a Macro running which enables the user to Lock the workbook down after relevant calculations have been completed. An Unlock function is also included should any errors have been spotted allowing the user to update the calculations, the problem is that once the unlock function has been activated some cells, (specifically free text cells) delete their contents on selection.

    Any guidance on this would be much appreciated, I need to be able to keep the contents of the cell and make additions to the free text.

    Regards

    Simon

  2. #2
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: After Worksheet Protect/Unprotect selection of cells deletes contents?

    if you can post your macro there are members here who are very reliable with regards to vba...
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  3. #3
    Registered User
    Join Date
    10-01-2010
    Location
    Doncaster, England
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: After Worksheet Protect/Unprotect selection of cells deletes contents?

    Hi,

    Lock function,

    Sub Lockall()

    Dim Shts as Worksheet

    With sheets("Front Page")
    .unprotect Password:="notimportant"
    .cells.locked = true
    .cells.formulahidden = true
    .protect password = "notimportant"

    End with

    ActiveWorkbook.protect password:="notimportant", structure:=true, Windows:=false

    End sub

    Unlock function

    Public sub undofill()

    Dim shts as worksheet

    With sheets ("General Details").activate
    Activesheet.unprotect password:="notimportant"
    End with
    With sheets ("General Details").cells.select
    End with
    Selection.locked = false
    selection.formulahidden = true
    range(C2,C3,F3,H3").select
    range ("H3").activate
    selection.locked = true
    selection.formulahidden = true
    Activesheet.protect password:="notimportant"
    activesheet.enableselection = xlunlockedcells

    end sub

    Thats pretty much it, I stripped out some other stuff as theres more sheets invloved and screen updating and display alerts but other than that its all the vba.

    regards

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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