I have been tasked with writing a user friendly analytical template at work. It is for some of our staff that has very poor excel skills. I know more and better training would be the more logical approach, however they are all 5 years and lower to retirement and this would be harder then you can possibly imagin.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
What I have is a template with two buttons. One to add a line and copy the previous row formulas, as follows:
<o></o>
Private Sub CommandButton4_Click()<o></o>
'make new row<o></o>
ActiveCell.EntireRow.Insert shift:=xlDown<o></o>
'copy the row<o></o>
ActiveCell.Offset(1).EntireRow.Copy Cells(ActiveCell.Row, 1)<o></o>
On Error Resume Next<o></o>
End Sub
<o></o>
And another to delete a line
<o></o>
Private Sub CommandButton3_Click()<o></o>
'to delet row<o></o>
ActiveCell.EntireRow.Delete<o></o>
End Sub
<o></o>
They both work great provided the excel worksheet isn’t protected.
<o></o>
My problem is on the rows I want to be able to add a line and delete a line I also have some formulas I need protected. When I protect the document these macro’s stop working.
<o></o>
If I set the macro up to unlock the page do the change and then relock it non of the cells are protected from the delete button. Some of the staff are click happy and would end up deleteing the entire document before they relize it.
<o></o>
What I need is either a code to prevent these macro’s from working on a specified area but allow it on another. (This area would of course always change as rows are added and deleted), or I need a different way to protect my regular formulas and headings so these macro’s will work.
<o></o>
Thanks for your help and time.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
What I have is a template with two buttons. One to add a line and copy the previous row formulas, as follows:
<o></o>
Private Sub CommandButton4_Click()<o></o>
'make new row<o></o>
ActiveCell.EntireRow.Insert shift:=xlDown<o></o>
'copy the row<o></o>
ActiveCell.Offset(1).EntireRow.Copy Cells(ActiveCell.Row, 1)<o></o>
On Error Resume Next<o></o>
End Sub
<o></o>
And another to delete a line
<o></o>
Private Sub CommandButton3_Click()<o></o>
'to delet row<o></o>
ActiveCell.EntireRow.Delete<o></o>
End Sub
<o></o>
They both work great provided the excel worksheet isn’t protected.
<o></o>
My problem is on the rows I want to be able to add a line and delete a line I also have some formulas I need protected. When I protect the document these macro’s stop working.
<o></o>
If I set the macro up to unlock the page do the change and then relock it non of the cells are protected from the delete button. Some of the staff are click happy and would end up deleteing the entire document before they relize it.
<o></o>
What I need is either a code to prevent these macro’s from working on a specified area but allow it on another. (This area would of course always change as rows are added and deleted), or I need a different way to protect my regular formulas and headings so these macro’s will work.
<o></o>
Thanks for your help and time.