The macro assumes that there are no empty cells in column A and that the data is sorted according to name.
Sub DelRows()
Application.ScreenUpdating = False
Dim LastRow As Long
LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Dim rng As Range
Dim fVisRow As Long
Dim response As Long
response = InputBox("Please enter the number of rows to delete.")
Sheets("Sheet1").Range("A1:A" & LastRow).AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Range("A1:A" & LastRow), Unique:=True
Set rnguniques = Sheets("Sheet1").Range("A2:A" & LastRow).SpecialCells(xlCellTypeVisible)
If Sheets("Sheet1").FilterMode Then Sheets("Sheet1").ShowAllData
For Each rng In rnguniques
If WorksheetFunction.CountIf(Range("A2:A" & LastRow), rng) >= 31 Then
Range("A1:A" & LastRow).AutoFilter Field:=1, Criteria1:=rng
fVisRow = Range("A2:A" & LastRow).SpecialCells(xlCellTypeVisible).Cells(1, 1).Row
Range("A2:A" & LastRow).Rows(fVisRow & ":" & fVisRow + response - 1).EntireRow.Delete
End If
Next rng
If ActiveSheet.AutoFilterMode = True Then ActiveSheet.AutoFilterMode = False
Application.ScreenUpdating = True
End Sub
Bookmarks