imback2nite
Board Regular
- Joined
- Oct 30, 2004
- Messages
- 203
- Office Version
- 2003 or older
- Platform
- Windows
Thank you for looking. Is there a way I can keep rows 1-10 from being deleted?
What I am doing is deleting rows selected by the user. All, that is, but for rows 1-10. These must not be deleted. The user will select the rows they want deleted then select my delete button. This will unprotect the page and delete the row and then protect it again. I am using this code. I appreciate all help!
What I am doing is deleting rows selected by the user. All, that is, but for rows 1-10. These must not be deleted. The user will select the rows they want deleted then select my delete button. This will unprotect the page and delete the row and then protect it again. I am using this code. I appreciate all help!
VBA Code:
Private Sub CommandButton2_Click()
ActiveSheet.Unprotect
Dim answer As Integer 'Delete Lines
answer = MsgBox("Have You Selected The Row(s) To Delete?", vbQuestion + vbYesNo + vbDefaultButton2, "Delete Row")
If answer = vbYes Then
Selection.EntireRow.Delete
Else
If answer = vbNo Then
MsgBox "Please Select Row To Delete.", , "Delete Row"
End If
End If
Application.ScreenUpdating = False
ActiveSheet.Protect
End Sub