+ Reply to Thread
Results 1 to 6 of 6

Issues with Code to Add New Table Row to a Protected Sheet

  1. #1
    Registered User
    Join Date
    08-30-2018
    Location
    Hastings, NE
    MS-Off Ver
    MS 365
    Posts
    74

    Issues with Code to Add New Table Row to a Protected Sheet

    I found some code on youtube to add a new row to a protected table via Form Controls Button, but it only adds a new table row if the sheet is unprotected. When it's protected it selects the cell directly underneath the table where new data is usually added but it's protected. I would greatly appreciate any input as to why this isn't working. Thank you all for taking the time to read this, here is the code:

    Please Login or Register  to view this content.
    Last edited by Kogen; 10-05-2018 at 12:24 PM. Reason: Format didn't meet forum rules

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Code Not Working

    Well... you need to set pswStr = "" to your actual password. Otherwise, it's using blank as password to unlock the sheet.

    And if that's not the password... it fails to unprotect.
    "Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something."
    ― Robert A. Heinlein

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    27,001

    Re: Issues with Code to Add New Table Row to a Protected Sheet

    Thanks, see post #2 for response.

  4. #4
    Registered User
    Join Date
    08-30-2018
    Location
    Hastings, NE
    MS-Off Ver
    MS 365
    Posts
    74

    Re: Code Not Working

    So, I set all passwords to "0" and it's still not working. I've attached a test file if taking a look will help. Originally, I had set the password to "" because this is going to distributed to others within my organization. I just wanted to remove the ability of messing up the formulas. Is there a work around to not require a password?

    OJT Tracker Test.xlsm

  5. #5
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Issues with Code to Add New Table Row to a Protected Sheet

    You have typo in your code.
    Please Login or Register  to view this content.
    It should be .Unprotect.

    FYI - Unless you know exactly what is going on in the code, don't use "On Error Resume Next". It ignores errors and pretends nothing has happened.

  6. #6
    Registered User
    Join Date
    08-30-2018
    Location
    Hastings, NE
    MS-Off Ver
    MS 365
    Posts
    74

    Re: Issues with Code to Add New Table Row to a Protected Sheet

    CK76,

    Thank you so much for your help! I made the suggested corrections and changed the password to "". Everything works just as it should 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. [SOLVED] This code not working in a Protected Sheet, can any one pls edit this code
    By rajeshn_in in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-12-2016, 01:08 AM
  2. [SOLVED] Pattern Building VBA Code - Working code, would like to use cleaner code
    By Benisato in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-10-2015, 03:05 PM
  3. [SOLVED] Vba code working in workbook module but not working from personal.xlb
    By satputenandkumar0 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-19-2014, 05:47 AM
  4. Replies: 1
    Last Post: 11-13-2013, 10:28 AM
  5. Removing code line stops code working?!?!?
    By adamj1910 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-31-2012, 02:36 PM
  6. [SOLVED] VBA Code (colums to row, autofill) stop working in row 294 when new cable code appear
    By sknifseht in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-29-2012, 05:27 AM
  7. Code for email alerts from excel isn't working, wrong code possibly?
    By jessthorogood in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-27-2012, 01:45 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