+ Reply to Thread
Results 1 to 4 of 4

Select locked cells resets on exit

  1. #1
    Registered User
    Join Date
    05-28-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2010
    Posts
    6

    Select locked cells resets on exit

    I created a form which uses various macros and VBA commands. All cells that are alowed to be changed are unlocked and all others locked without ability of being selected. Problem appears when I exit form and enter again, then locked cells become selectable. They are still locked but they can be selected and formated.

    Why does this hapen and how do I solve this problem?

    Thanks in advance for your help.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Select locked cells resets on exit

    Sounds like something's wrong with your macro. Can you post the code with some clear explainations on what you expect it to be doing?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    05-28-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Select locked cells resets on exit

    I use macro for buttons wich on click executes some calculations:

    Sub Button1_Click()
    Sheets("Sheet_1").Unprotect Password:=""
    ......
    Sheets("Sheet_1").Protect Password:="", UserInterFaceOnly:=True, AllowFormattingCells:=True, Contents:=True
    End Sub

    I have 3 buttons in Sheet_1 and 2 buttons in Sheet_2. All of them have this lines of code at the beginnig and the end of macro.
    Formating of unlocked cells must be possible.

    Thanks for your help.

  4. #4
    Registered User
    Join Date
    05-28-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Select locked cells resets on exit

    I put this line of code to module and problem solved

    Private Sub Workbook_Open()
    Dim wSheet As Worksheet
    For Each wSheet In Worksheets
    wSheet.Protect Password:="", _
    UserInterFaceOnly:=True
    Next wSheet
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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