+ Reply to Thread
Results 1 to 15 of 15

macro to insert row on last cell in a table of a protected worksheet

  1. #1
    Registered User
    Join Date
    11-15-2017
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    16

    Post macro to insert row on last cell in a table of a protected worksheet

    Hi everyone,

    My first post, so hopefully I get some help.

    I have a protected worksheet with formulas in cells A to AB, and approx 30 rows.
    I would like to allow the user insert a new row after entering data into the last cell in in the worksheet by either using tab or return.
    I would like all the formulas to copy to the new row.
    I would like the user to be able to put in as many rows as needed.
    Attached Files Attached Files

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: macro to insert row on last cell in a table of a protected worksheet

    Copy and paste this macro into the worksheet code module. Do the following: right click the tab for your Weld and NDT Log sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. Make a selection in cell B28. A new row with the drop down lists will be inserted below. This will happen each time the last cell in column B is populated.
    Please Login or Register  to view this content.
    If your sheet is protected with a password, the code will have to include that password.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Registered User
    Join Date
    11-15-2017
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    16

    Re: macro to insert row on last cell in a table of a protected worksheet

    That worked great! However, when I apply the code to a similar worksheet it does not work. I'm I missing something.

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: macro to insert row on last cell in a table of a protected worksheet

    You have to make sure that the macro is in the worksheet code module for the other sheet and that the other worksheet has exactly the same set up. Unfortunately "similar" is not good enough. They have to be identical in setup.

  5. #5
    Registered User
    Join Date
    11-15-2017
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    16

    Re: macro to insert row on last cell in a table of a protected worksheet

    I copied and pasted the code exactly. The sheet works the same way, just different columns of info.
    I really appreciate your help. I have attached the new file.
    Attached Files Attached Files

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: macro to insert row on last cell in a table of a protected worksheet

    I noticed that the two sheets are not identical. In the most recent version you have a "Comments" line which wasn't in the original version and to complicate matters that line is in an area of merged cells. You should avoid using merged cells as they almost always cause problems for excel macros. The macro also assumes that column A will never be empty. Try this macro:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    11-15-2017
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    16

    Re: macro to insert row on last cell in a table of a protected worksheet

    Thanks for your help.
    I noticed that when a user adds a row the protect sheet settings default back to select unlocked cells.
    How can I keep the settings I select when I protect the sheet.
    I would like the to be able to use:
    auto filter
    sort
    format rows
    delete rows
    pivottable reports

  8. #8
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: macro to insert row on last cell in a table of a protected worksheet

    Try:
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    11-15-2017
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    16

    Re: macro to insert row on last cell in a table of a protected worksheet

    That works great, however on another sheet the protect sheet settings would not let me delete the row. It was still asking for me to unprotect the sheet. I attached the workbook so you can see whats happening.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    11-15-2017
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    16

    Re: macro to insert row on last cell in a table of a protected worksheet

    I have one last form I am trying to get to work the same way. But I get a bug. It is not identical to the others. Any help would be greatly appreciated.
    Attached Files Attached Files

  11. #11
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: macro to insert row on last cell in a table of a protected worksheet

    Try the attached file.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    11-15-2017
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    16

    Re: macro to insert row on last cell in a table of a protected worksheet

    Fantastic!
    Ok last one.
    Same problem. Tried the latest code still didn't work.
    Don't understand why its not working. Again, thanks so much for your help
    Attached Files Attached Files

  13. #13
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: macro to insert row on last cell in a table of a protected worksheet

    If it's not working when you try to delete rows, I couldn't get it to work either and to be honest I really don't have a solution. I researched the issue and we seem to be doing everything right but still can't get it to work. Could I suggest you start a new thread explaining the exact nature of the problem. Attach a copy of your file. Most likely another forum member with more experience will be able to help. I would appreciate it that if you do find a solution, if you could send me a private message with a link to that solution so I can have a look. Sorry I couldn't be of more help.

  14. #14
    Registered User
    Join Date
    11-15-2017
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    16

    Re: macro to insert row on last cell in a table of a protected worksheet

    Ok thanks for trying.

  15. #15
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: macro to insert row on last cell in a table of a protected worksheet

    You're welcome.

+ 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. Replies: 1
    Last Post: 10-28-2015, 12:22 AM
  2. Macro to insert new row in protected worksheet
    By KoemansCC in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-11-2015, 09:29 AM
  3. Macro to Insert a Row and Delete Row in protected worksheet
    By dct in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-11-2015, 05:45 AM
  4. [SOLVED] Insert row for table on protected worksheet
    By Justair07 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-23-2013, 07:37 AM
  5. Copy and paste insert rows with protected cells in protected worksheet
    By excel_gecko in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-24-2012, 05:50 PM
  6. Macro to insert new row in Excel 2010 table (ListObject) in protected worksheet
    By kinsley in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-10-2012, 02:57 PM
  7. Replies: 8
    Last Post: 12-11-2009, 04:36 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