Onlock cells

I have a worksheet in Excel which is protected but allows the user to add rows as needed (thanks to Ture).  I just found out that when it adds rows, the rows are locked because that is the Excel default.  Here is the VBA as it is.  I need to add some lines that will unlock the cells in the added rows.

Sub InsertRow()
       If TypeOf Selection Is Range Then
         If Selection.Rows.Count = 1 Then
           ActiveSheet.Unprotect Password:="carrot"
           ActiveSheet.Protect Password:="carrot"
         End If
       End If
     End Sub
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I beleive all you should have to do is add this line directly after inserting the row:
Selection.Locked = False

If that doesn't work, then you will need some code to select the entire row, or whatever cells you want to unlock first.

Hope this helps,

FlakeAuthor Commented:
Thanks, ahammar!  That's what I needed.  I'm in old mode so post as answer pliz.
Hi Flake!
I'm glad it worked and thanks for the points!

Future readers:
Look at my last comment for answer.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.