ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Freeze pane (https://www.excelbanter.com/excel-programming/305704-freeze-pane.html)

joe

Freeze pane
 
Hi,

How can VBA be coded to specify a particular row that can
freeze pane? also, how can using the ".clear" method code
that will delete the unwanted cell(in row) that is not
required?

regards,
Joe

Norman Jones

Freeze pane
 
Hi Joe,

To split the active workbook at (say) row 2, try:

Sub Tester()

With ActiveWindow
.SplitColumn = 0
.SplitRow = 2
.FreezePanes = True
End With
End Sub

Adjust the row (and column) number to suit.

To remove the split ,

Sub Unsplit()

With ActiveWindow
.SplitColumn = 0
.SplitRow = 0
End With
End Sub

To delete the contents of a cell:

Range("A2").ClearContents

To delete the contents of a cell and remove its formatting:

Range("A2").Clear


---
Regards,
Norman



"Joe" wrote in message
...
Hi,

How can VBA be coded to specify a particular row that can
freeze pane? also, how can using the ".clear" method code
that will delete the unwanted cell(in row) that is not
required?

regards,
Joe




Tom Ogilvy

Freeze pane
 
Just some added info:
Freezepanes and split are two different approaches to a similar problem.
While Norman's code does accomplishe the intended purpose, if you then
unfreeze the window, you see that a split is also applied (freezepanes
appears to take precedence). Another way to apply a freezepane at row 2
without doing a split would be to select either row(3) or cell A3

Range("A3").Select
With ActiveWindow
.FreezePanes = True
End With

and to unfreeze

With ActiveWindow
.FreezePanes = False
End With

--
Regards,
Tom Ogilvy



"Norman Jones" wrote in message
...
Hi Joe,

To split the active workbook at (say) row 2, try:

Sub Tester()

With ActiveWindow
.SplitColumn = 0
.SplitRow = 2
.FreezePanes = True
End With
End Sub

Adjust the row (and column) number to suit.

To remove the split ,

Sub Unsplit()

With ActiveWindow
.SplitColumn = 0
.SplitRow = 0
End With
End Sub

To delete the contents of a cell:

Range("A2").ClearContents

To delete the contents of a cell and remove its formatting:

Range("A2").Clear


---
Regards,
Norman



"Joe" wrote in message
...
Hi,

How can VBA be coded to specify a particular row that can
freeze pane? also, how can using the ".clear" method code
that will delete the unwanted cell(in row) that is not
required?

regards,
Joe







All times are GMT +1. The time now is 12:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com