Hi B Sharma, One option not mentioned is to protect the sheet from VBA using the UserInterfaceOnly option. With this option, your VBA code does not have to unprotect the sheet - it has untethered access. The sheet will be protected from direct interaction with the user only.
For that, you could use code like this: Sub ProtectSheet(Sheet As Object, Optional Password As String) ' I made Sheet an Object so this routine could equally protect ' a Worksheet or a Chart sheet. ' Include any protection options desired below. Sheet.Protect Password:=Password, UserInterfaceOnly:=True End Sub Sub ActiveRowInsertBefore() ActiveCell.EntireRow.Insert EndSub Sub ActiveRowDelete() If MsgBox("Delete current Row?", vbOKCancel) = vbOK Then ActiveCell.EntireRow.Delete End If End Delete Asa From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] On Behalf Of B Sharma Sent: Friday, July 06, 2012 6:22 AM To: excel-macros@googlegroups.com Cc: Rajan_Verma Subject: $$Excel-Macros$$ Re: VBA Code for inserting a row in table in protected sheet Dear Friend Noorain, Thanks for your quick reply... I tried this but failed, I was unable to insert rows in the table. I have attached a file for your reference too. Please see and help. BS On Friday, July 6, 2012 5:15:20 PM UTC+5:30, B Sharma wrote: Dear Excel Experts, I have a protected data sheet, where I want to insert row where the cursor is selected. I need a VBA code who will do the following: 1. Unprotect the sheet (with password) 2. Insert a row in the table where the cursor is pointed. 3. Protect the sheet (with password) I need the same to for deleting a row (with confirmation) Please help.... , I have searched everywhere on net but didnt find any.. Thanks & Regards, BS -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ---------------------------------------------------------------------------- -------------------------- To post to this group, send email to excel-macros@googlegroups.com To unsubscribe, send a blank email to excel-macros+unsubscr...@googlegroups.com -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ------------------------------------------------------------------------------------------------------ To post to this group, send email to excel-macros@googlegroups.com To unsubscribe, send a blank email to excel-macros+unsubscr...@googlegroups.com