hi,
im not too clued up on microsoft excel. Im running a macro that my boss has set up which takes data from a list and sorts it into alphabetical order. The macro works fine until I either add or remove data, then i get this error.
here is the macro.....


Sub pr_HideAndSort()
  '
  ' sort Macro

  Worksheets("Summary").Activate
  Range("D2").Select

  Do

    If ActiveCell.Value = "" And Selection.EntireRow.Hidden = False Then
  
      ' move left to ensure we're still within the data
      ActiveCell.Offset(0, -1).Select
  
      If ActiveCell.Value <> "" Then
        ' Hide the row
        Rows(ActiveCell.Row).Select
        Selection.EntireRow.Hidden = True
        ActiveCell.Offset(0, 3).Select
      Else
        Exit Do
      End If
  
    End If

    ActiveCell.Offset(1, 0).Select

  Loop

    Range("A2").Select
    Range(Selection, Selection.End(xlDown)).Select
    Range(Selection, Selection.End(xlToRight)).Select
    Selection.sort Key1:=Range("D2"), Order1:=xlAscending, Header:=xlNo, _
                   OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
                   DataOption1:=xlSortNormal

  Range("A2").Select

End Sub

Sub pr_Restore()

  ' Restore Macro

  ' Unhide all the rows we've hidden
  Worksheets("Summary").Activate
  Range("A1").Select

  Range(Selection, Selection.End(xlDown)).Select
  Range(Selection, Selection.End(xlToRight)).Select
  Selection.EntireRow.Hidden = False
  Range("A2").Select

  Range(Selection, Selection.End(xlDown)).Select
  Range(Selection, Selection.End(xlToRight)).Select
  Selection.sort Key1:=Range("A2"), Key2:=Range("B2"), Key3:=Range("C2"), Order1:=xlAscending, Header:=xlNo, _
                 OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
                 DataOption1:=xlSortNormal

  Range("A2").Select
End Sub
someone please help!!!!!!!

like i said, i am not too clued up on excel so treat it like your talking to an idiot lol.