Select the row you want to pin (keep visible).
Go to the View tab.
Click Freeze Panes.
Select Freeze Top Row (if pinning the first row).
Select Freeze Panes (if you selected a row below the one you want to pin).
To unpin, go to the View tab.
Click Freeze Panes.
Select Unfreeze Panes.
