While the code here is VBA, it should be directly transcribable to other languages and platforms. As you Enter the Sales figures, both the Month and the Location remain visible. Now all rows above Row 2 are frozen and all columns to the left of Column B are frozen.
The core process is really just a reiteration of previously submitted answers but I thought it was important to demonstrate how to deal with ActiveWindow when you are not within Excel's own VBA. On the View tab, in the Window group, click Freeze Panes, Freeze Panes. SaveAs FileName:=fn, FileFormat:=xlOpenXMLWorkbook If CBool(Len(Dir(fn, vbNormal))) Then Kill fn
'This is where the Freeze Pane is dealt withįn = CurrentProject.Path & "\Reports\Report_" & Format(Date, "yyyymmdd") & ".xlsx" Set xlApp = CreateObject("Excel.Application") Now, click the Layout tab on the toolbar Navigate to the Window group and click Freeze Panes ribbon. In the Format Chart Area pane, click the Size & Properties icon. But what if you want to freeze columns instead If you desire to see specific columns of your spreadsheets all the time, its straightforward. With the proper cell selected, select the View tab at the top and. For example, if you wanted to freeze column A and row 1, you would select cell B2 since it’s below and to the right of these columns and rows. This confirms that the chart area is selected. To freeze a set of columns and rows at the same time, click on the cell below and to the right of the panes you want to freeze. Ensure the resize handles are around the border of the chart. Option Explicitĭim xlApp As Excel.Application, ws As Worksheet, wb As Workbook If you do not see the option to format the chart area, you might have clicked on the wrong part of the chart. Youd select cell D5, and then on the View tab, click Freeze Panes. Say you want to freeze the top four rows and leftmost three columns. Using the Excel.Application object in another Office application's VBA project will require you to add Microsoft Excel 15.0 Object library (or equivalent for your own version). To freeze multiple columns, select the column to the right of the last column you want frozen and click Freeze Panes. S own VBA, the ActiveWindow property must be addressed as a child of the Excel.Application object.Įxample for creating an Excel workbook from Access: To expand this question into the realm of use outside of Excel