Hi - I currently have the below macro which works really well in deleting entire rows. It first highlights the selected rows for deletion, and then prompts a message box for users to confirm or cancel deletion. Neat
What I have noticed though is that once the rows are deleted, any cells that had lists applied to them (although they are being 'cleared') are not having the data validation / drop down lists removed.
Is there any additional code I can add to clear these too? Thanks in advance, Matt.
Private Sub Remove_Recipient_Click()
Dim c As Range, DltRng As Range
For Each c In Selection
If DltRng Is Nothing Then
Set DltRng = c
Else
Set DltRng = Union(c, DltRng)
End If
Next c
If Not DltRng Is Nothing Then DltRng.EntireRow.Interior.ColorIndex = 6
Rply = MsgBox("Warning - This can not be undone!" & vbNewLine & vbNewLine & "Are the highlighted row(s) the ones you want to delete?" & vbNewLine & vbNewLine & "If not click NO and first select any cell from the appropriate row(s)", vbYesNo)
If Rply = vbYes Then
DltRng.EntireRow.Delete
ActiveCell.Select
Else
DltRng.EntireRow.Interior.ColorIndex = xlNone
MsgBox "No rows were deleted."
End If
End Sub
Bookmarks