A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
If you just want the result of the formula, try
ActiveSheet.Range("E" & r).Value = ActiveSheet.Range("E1").Value
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi
I have a protected sheet contain formula in each row depends to above row( for example C2=C1+1; C3=C2+1;...).and cells contained these formula are locked.
I like to allow users to insert row everywhere by keeping formula without unprotecting the sheet. When I am clicking "insert row" while protecting the sheet, users could insert a row but the locked inserted cells are not including any formula and excel doesn't permit to copy formula of above cells. is there any solution?
Thanks
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
If you just want the result of the formula, try
ActiveSheet.Range("E" & r).Value = ActiveSheet.Range("E1").Value
In the first place: to prevent the users from viewing the macro and seeing the password to unlock the sheet, you must protect the Visual Basic project of the workbook with a password.
Let's say the password is "secret". The following macro will insert a row and fill down the formula in column C:
Sub InsertARow()
Dim r As Long
On Error GoTo ErrHandler
' Get the row number
r = Range("C10").Value
' Unprotect the sheet
ActiveSheet.Unprotect Password:="secret"
' Insert a row
Range("C" & r).EntireRow.Insert
' Fill down the formula from above the inserted row to below it
Range("C" & (r - 1) & ":C" & (r + 1)).FillDown
ExitHandler:
' Protect the sheet again
ActiveSheet.Protect Password:="secret"
' Get out
Exit Sub
ErrHandler:
' Report the error to the user
MsgBox Err.Description, vbExclamation
' Always go past the exit handler section
Resume ExitHandler
End Sub
What i want to be able to do is have a protected sheet with locked and unlocked cells (I know how to do this) I also want to be able to allow my users to insert rows while protected (i am able to make this happen as well). I have certain columns throughout the spreadsheet that have formulas in them and I want to be able to have that formula carry through when they insert a row. Now if it is unprotected I know of a way to get this to happen, what I don't know is when it is locked how to get it to happen.
Example
Users enter date in unlocked columns A, B & C through rows 1 through 100, but in column D there is a formula that is based on columns A+B+C. So say at any point in the spreadsheet on any row while locked and protected I want to be able to allow a user to insert a row, enter data in the unlocked cells and keep the formula in the locked cell continous
so say D1=SUM(A1+B1+C2), D2=SUM(A2+B2+C2) and so on all the way down to 100 (arbitrary large number that they will like never get to in a month) However sometimes data needs to be grouped together because it is part of the same account so say anywhere in the spreadsheet I want to insert a row anywhere in between the 1 and 100 rows and I want Column D to refelct that formula and result when users enter the date in the newly inserted rows.
I hope that makes sense. Thanks for you help.
The requirement in this thread was that the user would enter a row number in cell C10, and that the macro would insert a row at that row number. So if the user enters 37 in C10, a row would be inserted at row 37.
You probably want something else - can you explain what exactly?
Sir,
Namaskar! I have a sheet having column A to T and row number is 677. Most of the cells have formula.
Can i put a row containing formula of above cells only when i make entry in last row. For example if last row is 677 and i make entry in this row. as soon as 677 entry passed nex row 678 should insert automatically.
Regards
RR Singh