Excel – How to make recorded macro work on any sheet?

Excel recorded macro will have references to worksheet like this:

ActiveWorkbook.Worksheets("MystupidSpreadSheet(1)").ListObjects("Table_owssvr__2").Sort. _
    SortFields.Clear

You'll need to change the macro to reference the worksheet name by index number

 ActiveWorkbook.Worksheets(1)