Camilla1980
New Member
- Joined
- Mar 22, 2018
- Messages
- 13
Hi,
I have an auto sheet event script running on my workbook which deletes a row from sheet 1 and moves it to 2 other worksheets when completed:-
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
If Not Intersect(Target, Range("N:N")) Is Nothing And Target.Value = "Yes" Then
If MsgBox("Completed?", vbYesNo) = vbNo Then Exit Sub
If Not Evaluate("isref('" & Range("E" & Target.Row) & "'!$B$1)") Then
MsgBox "sheet " & Range("E" & Target.Row).Value & " does not exist"
Exit Sub
End If
With Rows(Target.Row)
.Copy Sheets(Range("E" & Target.Row).Value).Range("A" & Rows.Count).End(xlUp).Offset(1)
.Copy Sheets("Raw Data").Range("A" & Rows.Count).End(xlUp).Offset(1)
.Delete
End With
End If
End Sub
I now need to protect the formula in one column but this will stop the row from being deleted unless I unprotect the sheet.
Can I add to the code so that it unprotects the sheet (say with a password, Secret) and once the action is completed, it protects the sheet again?
If it's possible, where would it fit in my code?
My knowledge of VBA and such is absolutely zero, so any help would be really appreciated!
Thanks
Camilla
I have an auto sheet event script running on my workbook which deletes a row from sheet 1 and moves it to 2 other worksheets when completed:-
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
If Not Intersect(Target, Range("N:N")) Is Nothing And Target.Value = "Yes" Then
If MsgBox("Completed?", vbYesNo) = vbNo Then Exit Sub
If Not Evaluate("isref('" & Range("E" & Target.Row) & "'!$B$1)") Then
MsgBox "sheet " & Range("E" & Target.Row).Value & " does not exist"
Exit Sub
End If
With Rows(Target.Row)
.Copy Sheets(Range("E" & Target.Row).Value).Range("A" & Rows.Count).End(xlUp).Offset(1)
.Copy Sheets("Raw Data").Range("A" & Rows.Count).End(xlUp).Offset(1)
.Delete
End With
End If
End Sub
I now need to protect the formula in one column but this will stop the row from being deleted unless I unprotect the sheet.
Can I add to the code so that it unprotects the sheet (say with a password, Secret) and once the action is completed, it protects the sheet again?
If it's possible, where would it fit in my code?
My knowledge of VBA and such is absolutely zero, so any help would be really appreciated!
Thanks
Camilla