Trying to use a VBA script to insert an automatic page break when a column value changes. Watched a YT demo that works, but mine errors out w/ "application-defined or object-defined error."

Sub AddPgBrk()
    For Each Cell In Selection
        ActiveWindow.ActiveSheet.HPageBreaks.Add _
            Before:=Cell
        Next Cell
End Sub