+ Reply to Thread
Results 1 to 5 of 5

Protect/unprotect

  1. #1
    Registered User
    Join Date
    06-02-2018
    Location
    USA
    MS-Off Ver
    Office 16
    Posts
    8

    Protect/unprotect

    Hello all,

    So I created this excel file with a few macros. I have a drop down menu and depending on what you select it will run a specific macro...Issue im having is when I protect the sheet I get the error “the cell or chart you’re trying to change is on a protected sheet. To make a change unprotect sheet. You might he requested to enter a password”. So I have tried codes to unprotect sheet with no luck. Maybe im added them in the wrong place. If I run everything with sheets unprotected it works fine...thanks in advance

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,957

    Re: Protect/unprotect

    Post your code and/or the workbook.

    1. You could change the way you protect the sheet to allow some cells to be changed (unlock them)
    2. Use Application.UserInterfaceOnly
    3. Unprotect before making change, Protect again afterwards

    No way to know what approach is best without seeing code (and testing it in the workbook).
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    06-02-2018
    Location
    USA
    MS-Off Ver
    Office 16
    Posts
    8

    Re: Protect/unprotect

    Yes I have been trying to unprotect run code then protect at end of code, I have also tried to UserInterfaceOnly and still not allowing me to preform Macro.

  4. #4
    Registered User
    Join Date
    06-02-2018
    Location
    USA
    MS-Off Ver
    Office 16
    Posts
    8

    Re: Protect/unprotect

    Below is the code: This is executed by me choosing "FAST ROPES" on a drop down list

    Sub FASTROPES_CONFIG()
    '
    ' FASTROPES_CONFIG Macro
    '
    Application.ScreenUpdating = False
    '
    Range("I6").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("I7").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("I8").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("I9").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("I10").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("I11").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("I12").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("I13").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("I14").Select
    ActiveCell.FormulaR1C1 = "YES"
    Range("I15").Select
    ActiveCell.FormulaR1C1 = "YES"
    Range("I16").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("I17").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("I18").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("I19").Select
    ActiveCell.FormulaR1C1 = "YES"
    Range("I20").Select
    ActiveCell.FormulaR1C1 = "YES"
    Range("I21").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("I24").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("I25").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("I26").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("I27").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("I28").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("I29").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("I30").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("I31").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("I32").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("L6").Select
    ActiveCell.FormulaR1C1 = "YES"
    Range("L7").Select
    ActiveCell.FormulaR1C1 = "YES"
    Range("L8").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("L9").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("L10").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("L11").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("L12").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("L13").Select
    ActiveCell.FormulaR1C1 = "YES"
    Range("L14").Select
    ActiveCell.FormulaR1C1 = "YES"
    Range("L15").Select
    ActiveCell.FormulaR1C1 = "NO"
    Range("L16").Select
    ActiveCell.FormulaR1C1 = "YES"
    Range("L17").Select
    ActiveCell.FormulaR1C1 = "YES"
    Range("L18").Select
    ActiveCell.FormulaR1C1 = "YES"
    Range("L19").Select
    ActiveCell.FormulaR1C1 = "YES"
    Range("L20").Select
    ActiveCell.FormulaR1C1 = "YES"
    Range("L21").Select
    ActiveCell.FormulaR1C1 = "YES"
    Range("L22").Select
    ActiveCell.FormulaR1C1 = "YES"
    Range("L23").Select
    ActiveCell.FormulaR1C1 = "YES"
    Range("L24").Select
    ActiveCell.FormulaR1C1 = "YES"
    Range("L25").Select
    ActiveCell.FormulaR1C1 = "YES"
    Range("L26").Select
    ActiveCell.FormulaR1C1 = "YES"
    Range("L27").Select


    Range("A7").Select
    ActiveCell.FormulaR1C1 = "ROPE MASTER(s)"
    Range("A8").Select
    ActiveCell.FormulaR1C1 = "FASTROPERS"
    Range("B7").Select
    ActiveCell.FormulaR1C1 = "200"
    Range("B8").Select
    ActiveCell.FormulaR1C1 = "800"

    Range("c8").Select
    ActiveCell.FormulaR1C1 = "117"



    Range("H35:I35").Select
    ActiveCell.FormulaR1C1 = "FAST ROPE BAR (119 Lbs)"
    Range("H36:I36").Select
    ActiveCell.FormulaR1C1 = "FAST ROPE (80 Lbs)"
    Range("H37:I37").Select
    Sheet3.Visible = True
    Sheets("Values").Select
    Range("H81:J81").Select
    ActiveCell.FormulaR1C1 = "fast rope bar"
    Range("K81").Select
    ActiveCell.FormulaR1C1 = "119"
    Range("L81").Select
    ActiveCell.FormulaR1C1 = "129"
    Range("H82:J82").Select
    ActiveCell.FormulaR1C1 = "fast rope "
    Range("K82").Select
    ActiveCell.FormulaR1C1 = "80"
    Range("L82").Select
    ActiveCell.FormulaR1C1 = "129"
    Range("M81").Select
    ActiveCell.FormulaR1C1 = "=RC[-2]*RC[-1]"
    Range("M82").Select
    ActiveCell.FormulaR1C1 = "=RC[-2]*RC[-1]"
    Range("M83").Select
    Sheet3.Visible = xlSheetVeryHidden
    Sheets("Longitudinal").Select


    Application.ScreenUpdating = True

    End Sub

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,957

    Re: Protect/unprotect

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional.)


    In the meantime, please see the attached workbook.
    Attached Files Attached Files

+ 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. [SOLVED] Protect / unprotect
    By MIGARDEIN in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-18-2015, 04:17 PM
  2. VBA protect and unprotect
    By NotSwank in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-03-2014, 02:11 PM
  3. Protect/Unprotect as an event??
    By MontySmall in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-15-2013, 11:03 AM
  4. Excel 2007 : protect and unprotect
    By runball in forum Excel General
    Replies: 0
    Last Post: 09-07-2009, 10:03 AM
  5. Protect and Unprotect using vba
    By mbrady1973 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-01-2009, 07:47 AM
  6. Protect UserInterface VS Protect/Unprotect
    By Desert Piranha in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-31-2006, 11:08 PM
  7. [SOLVED] protect and unprotect
    By Andrew in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-13-2005, 03:05 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