0

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.

1 Answer 1

2

Perhaps use the following?

Selection.EntireRow.Delete

You can select multiple cells, click the button, and the associated row will be deleted.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.