Macro not working

You want to remove all records except for headers ryt??
try this

Sub Macro5()

Rows("2:30000").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp

End Sub

or for filtered data
Sub Macro7()

Rows("1:1").Select
Selection.Offset(1, 0).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Delete Shift:=xlUp

End Sub