PDA

View Full Version : Excel Macro Freeze Panes


adalton
Jun 10, 2009, 06:54 PM
When I record a macro to freeze panes it gives me this code:

Rows("1:4").Select
ActiveWindow.FreezePanes = True

But when I put it into my macro it freezes a bunch of rows and even some columns. Is there another way to do this? It is selecting the rows its just not freezing the right ones.

JBeaucaire
Jun 10, 2009, 07:25 PM
What ONE cell do want to freeze by?

If you select a cell in column A, it freezes all rows above but the whole sheet scrolls down in rows.

If you select a cell in Row 1, it freezes columns to the left of the choice and scrolls the sheet across in columns.

If you select anything else, it will freeze above and to the left of the cell chosen.

So, what one cell are you going to select?

Based on your example above, it appears to me you want to freeze the first 4 rows onscreen. If so, use this:


Rows("A5").Select
ActiveWindow.FreezePanes = True