Reputation: 35
I have a excel sheet with command button to select and delete one row. Deletion can be done only for Rows after 12th row. below is the code I have:-
Sub Button_delete_row()
If ActiveCell.Row > 12 Then
ActiveSheet.Unprotect "xxxx"
Rows(ActiveCell.Row).Delete
ActiveSheet.Protect "xxxx", True, True
End If
End Sub
With my above code in command button, I can select only one row by highlighting with mouse click and deleting. My problem is I want to select multiple rows by highlighting with mouse drag and click on command button to delete these rows.
Upvotes: 0
Views: 732
Reputation: 100
Perhaps use the following?
Selection.EntireRow.Delete
You can select multiple cells, click the button, and the associated row will be deleted.
Upvotes: 2