+ Reply to Thread
Results 1 to 6 of 6

Add row to table in Excel 2010 Password Protected Sheet with formulas

Hybrid View

  1. #1
    Registered User
    Join Date
    04-02-2012
    Location
    Earth
    MS-Off Ver
    Excel 2013
    Posts
    33

    Angry Add row to table in Excel 2010 Password Protected Sheet with formulas

    I have a Table with locked, unlocked and drop down box cells within it. This is because they contain formulas. Drop down box's to help with formulas. the sheet is locked to avoid tamper with the formulas

    i have created a button to press which inserts a row at the bottom of the table with all the formals etc

    i can insert a new row using this (when document is not password protected)

    Selection.ListObject.ListRows.Add AlwaysInsert:=True
    Range("A191").Select

    but i need to add something like

    ActiveSheet.Protect Password:="password"

    can some one help with this please

    thanks

  2. #2
    Forum Contributor bonny24tycoon's Avatar
    Join Date
    04-02-2012
    Location
    Hell
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    405

    Re: Add row to table in Excel 2010 Password Protected Sheet with formulas

    Hi There,

    You would need to do the below -

    1. Protect your sheet with password as "password"

    2. You would then need to enter the below code on your macro where you need the macro to unprotect the sheet, so that a row is added.

    ActiveSheet.Unprotect Password:="password"
    3. You would then need to enter the below code on your macro where you need the macro to again protect the sheet.

    ActiveSheet.Protect Password:="password"

    Or paste your entire macro here, so I can help you if its confusing

    Let me know if it worked.



    Thanks,

    Bonny Tycoon



    **If I was able to help please click the small star icon at the bottom left of my post **

  3. #3
    Registered User
    Join Date
    04-02-2012
    Location
    Earth
    MS-Off Ver
    Excel 2013
    Posts
    33

    Re: Add row to table in Excel 2010 Password Protected Sheet with formulas

    thanks for the above it makes perfect sense

    i can use the below to add a row to a table with locked cells on a protected sheet and all formulas from above go into the new row as well


    Private Sub CommandButton1_Click()
    ActiveSheet.Unprotect Password:="password"
        Selection.ListObject.ListRows.Add AlwaysInsert:=True
        ActiveSheet.Protect Password:="password"
    End Sub

    thanks for your help
    Last edited by arlu1201; 08-10-2012 at 03:54 PM.

  4. #4
    Registered User
    Join Date
    08-10-2012
    Location
    New York, USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Add row to table in Excel 2010 Password Protected Sheet with formulas

    How can I add to unlock just the newly inserted row so the user can add data?

    Thanks,
    -Don

  5. #5
    Registered User
    Join Date
    10-29-2012
    Location
    winnipeg, manitoba
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Add row to table in Excel 2010 Password Protected Sheet with formulas

    HI,

    I used the code but it gives me a runtime error 91 object variable or with block variable not set. any help will be appreciated

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Add row to table in Excel 2010 Password Protected Sheet with formulas

    Kinsley,

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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