jeudi 26 novembre 2015

Delete checkboxes in the active row and delete the entire row

I originally wanted a simple macro to delete the entire row. I created this and soon found out it didn't delete the checkboxes. I tried to improvise and create a new macro that deleted all checkboxes in the active row and then deleted the row.

Unfortunately I was only able to delete checkboxes in the active cell and not the active row.

Sub DeleteCheckboxandRow()

Dim cb As CheckBox

For Each cb In ActiveSheet.CheckBoxes
    If cb.TopLeftCell.Address = ActiveCell.Address Then cb.Delete
Next
Rows(ActiveCell.Row).EntireRow.Delete
End Sub

Is someone able to explain how I can modify the above macro to delete the checkboxes from the whole active row not just the active cell?




Aucun commentaire:

Enregistrer un commentaire