hk2: to operate on a given a sheet, it must have the focus. so you need to add a "sht.Select" or "sht.Activate" before attempting to freeze the row
Change:
For Each sht In ActiveWorkbook.Worksheets sht.Range("A2").Select sht.Range("A2").Activate ActiveWindow.FreezePanes = True Next sht
To:
For Each sht In ActiveWorkbook.Worksheets Sht.Select 'COMMENT: can also use Sht.Activate here sht.Range("A2").Activate ActiveWindow.FreezePanes = True Next sht