Excel VBA freeze top 2 rows

Whenever you're working with a lot of data, it can be difficult to compare information in your workbook. Fortunately, Excel includes several tools that make it easier to view content from different parts of your workbook at the same time, including the ability to freeze panes and split your worksheet.

Optional: Download our practice workbook.

Watch the video below to learn more about freezing panes in Excel.

To freeze rows:

You may want to see certain rows or columns all the time in your worksheet, especially header cells. By freezing rows or columns in place, you'll be able to scroll through your content while continuing to view the frozen cells.

  1. Select the row below the row(s) you want to freeze. In our example, we want to freeze rows 1 and 2, so we'll select row 3.
  2. On the View tab, select the Freeze Panes command, then choose Freeze Panes from the drop-down menu.
  3. The rows will be frozen in place, as indicated by the gray line. You can scroll down the worksheet while continuing to view the frozen rows at the top. In our example, we've scrolled down to row 18.

To freeze columns:

  1. Select the column to the right of the column(s) you want to freeze. In our example, we want to freeze column A, so we'll select column B.
  2. On the View tab, select the Freeze Panes command, then choose Freeze Panes from the drop-down menu.
  3. The column will be frozen in place, as indicated by the gray line. You can scroll across the worksheet while continuing to view the frozen column on the left. In our example, we've scrolled across to column E.

If you only need to freeze the top row (row 1) or first column (column A) in the worksheet, you can simply select Freeze Top Row or Freeze First Column from the drop-down menu.

To unfreeze panes:

If you want to select a different view option, you may first need to reset the spreadsheet by unfreezing panes. To unfreeze rows or columns, click the Freeze Panes command, then select Unfreeze Panes from the drop-down menu.

Other view options

If your workbook contains a lot of content, it can sometimes be difficult to compare different sections. Excel includes additional options to make your workbooks easier to view and compare. For example, you can choose to open a new window for your workbook or split a worksheet into separate panes.

To open a new window for the current workbook:

Excel allows you to open multiple windows for a single workbook at the same time. In our example, we'll use this feature to compare two different worksheets from the same workbook.

  1. Click the View tab on the Ribbon, then select the New Window command.
  2. A new window for the workbook will appear.
  3. You can now compare different worksheets from the same workbook across windows. In our example, we'll select the 2013 Sales Detailed View worksheet to compare 2012 and 2013 sales.

If you have several windows open at the same time, you can use the Arrange All command to rearrange them quickly.

To split a worksheet:

Sometimes you may want to compare different sections of the same workbook without creating a new window. The Split command allows you to divide the worksheet into multiple panes that scroll separately.

  1. Select the cell where you want to split the worksheet. In our example, we'll select cell D6.

  2. Click the View tab on the Ribbon, then select the Split command.
  3. The workbook will be split into different panes. You can scroll through each pane separately using the scroll bars, allowing you to compare different sections of the workbook.
  4. After creating a split, you can click and drag the vertical and horizontal dividers to change the size of each section.

To remove the split, click the Split command again.

Challenge!

Within our example file, there is A LOT of sales data. For this challenge, we want to be able to compare data for different years side by side. To do this:

How can I freeze top 2 rows in Excel?

Freeze columns and rows.
Select the cell below the rows and to the right of the columns you want to keep visible when you scroll..
Select View > Freeze Panes > Freeze Panes..

How do you freeze the second top row?

Freeze columns and rows in Excel.
Select the row below the row(s) you want to freeze (select row 6, if you want to freeze rows 1 to 5)..
On the View tab, click Freeze Panes > Freeze Panes..

How do you keep top two rows always on top when scrolling?

If you want the row and column headers always visible when you scroll through your worksheet, you can lock the top row and/or first column. Tap View > Freeze Panes, and then tap the option you need.

Toplist

Latest post

TAGs