To freeze or lock rows and columns in an Excel worksheet, follow these steps:
Select the cell below the row you want to freeze or to the right of the column you want to freeze.
Go to the "View" tab on the Excel ribbon.
In the "Window" group, click on the "Freeze Panes" dropdown menu.
From the options in the dropdown menu, you can select one of the following:
"Freeze Panes" to freeze both rows and columns based on the selected cell.
"Freeze Top Row" to freeze only the top row.
"Freeze First Column" to freeze only the first column.
"Freeze Panes and Split" to freeze both rows and columns and split the window into multiple panes.
Click on the desired option, and the selected rows and/or columns will be frozen or locked in place.
To unfreeze the rows and columns, simply go back to the "Freeze Panes" dropdown menu and click on "Unfreeze Panes".