Results 1 to 9 of 9

Creating a button to lock specific cells

Threaded View

  1. #1
    Registered User
    Join Date
    03-21-2019
    Location
    London, England
    MS-Off Ver
    2016
    Posts
    4

    Creating a button to lock specific cells

    The problem I'm facing is giving me a headache.

    First of all, let me give you a brief idea of what I've done:

    I locked all the cells by "protect sheet" option, and checked the "select unlocked cells" option.

    But there's a specific cells that I want the users to fill and use, so I went to format cells - protection - unchecked the "lock" checkbox.

    Whats the problem?

    Simply, I want to create a multi buttons, each of these buttons responsible of locking specific area of cells. Its important that the users are not able to select the cells or unlock it after the button is pressed, unless they have the password I put.


    I put this code, but its not working:

    
    Private Sub CommandButton1_Click()
    
    Range("B38:B39").Select
    
    Selection.Locked = True
    
    Selection.FormulaHidden = False
    
    ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:=False, AllowFormattingCells:=True, AllowFormattingColumns:=True, AllowFormattingRows:=True, AllowInsertingColumns:=True, AllowInsertingRows:=True, AllowInsertingHyperlinks:=True, AllowDeletingColumns:=True, AllowDeletingRows:=True, AllowSorting:=True, AllowFiltering:=True, AllowUsingPivotTables:=True
    
    End Sub

    thanks.
    Last edited by 6StringJazzer; 03-21-2019 at 04:42 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Button to clear and lock cells
    By Oeysbrei in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-17-2017, 10:28 AM
  2. Lock Button that Locks Specific Cells
    By mushman1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-16-2015, 09:35 PM
  3. Button to lock cells
    By Burlinghamla in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-24-2015, 08:40 AM
  4. Macro to lock button with specific criteria
    By tanay.vinod in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-09-2014, 11:23 PM
  5. How to lock or unclock cells using a button
    By nageshpolu in forum Excel General
    Replies: 3
    Last Post: 06-18-2014, 10:27 AM
  6. Button to copy specific cells to another sheet, lock button if cell has text
    By elmerg in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-14-2014, 02:10 AM
  7. Protect/Lock specific cells independently through button
    By Edward HS in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-04-2008, 02:47 PM

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