+ Reply to Thread
Results 1 to 5 of 5

VBA to lock cells on every sheet in workbook

  1. #1
    Registered User
    Join Date
    02-19-2019
    Location
    USA
    MS-Off Ver
    Office 2013
    Posts
    15

    VBA to lock cells on every sheet in workbook

    I've used a few examples of VBA scripts available online to achieve what I have so far below. It works great on just the sheet the macro button is located on. I would like to edit this to go through and repeat the cell locking procedure on each sheet in the workbook is there an easy change that will do that? Apologies, still learning how VBA works.

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    02-19-2019
    Location
    USA
    MS-Off Ver
    Office 2013
    Posts
    15

    Re: VBA to lock cells on every sheet in workbook

    I tried messing with it more, and I get this error (note, the Unprotectall() is working fine to unlock each sheet.

    Also to note, I do not want to password protect these sheets, just keep the formulas and data from being edited unknowingly by the end user.

    Please Login or Register  to view this content.
    protectError.JPG

  3. #3
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,015

    Re: VBA to lock cells on every sheet in workbook

    .
    Try this :

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    02-19-2019
    Location
    USA
    MS-Off Ver
    Office 2013
    Posts
    15

    Re: VBA to lock cells on every sheet in workbook

    I'm still getting an error with the changes. It does look like a different message for the 1004 error this time though. any thoughts?

    lockerror.JPG

  5. #5
    Registered User
    Join Date
    02-19-2019
    Location
    USA
    MS-Off Ver
    Office 2013
    Posts
    15

    Re: VBA to lock cells on every sheet in workbook

    I changed to adding the color locking macro button to all sheets that will need it and now just lock cells then use a global protect / unprotect macro. I appreciate the help, all set now.

+ 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. Need to lock a sheet within a workbook after specific date
    By hewcarroll in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-28-2017, 01:17 PM
  2. Lock a single sheet in a workbook
    By Vibro in forum Excel General
    Replies: 3
    Last Post: 10-05-2016, 09:56 AM
  3. [SOLVED] Macro to unlock sheet, copy to new workbook, then re-lock original sheet
    By Foos Master in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-08-2015, 09:16 PM
  4. Lock selected cells in all the sheets in a workbook
    By S@2014 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-28-2014, 08:02 AM
  5. Replies: 5
    Last Post: 07-15-2013, 03:57 AM
  6. Can I password Lock a sheet in a Workbook
    By ukphoenix in forum Excel Programming / VBA / Macros
    Replies: 36
    Last Post: 07-15-2008, 03:59 PM
  7. [SOLVED] Lock sheet tabs option in a specific workbook
    By Tarique in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-08-2006, 11:55 AM

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