ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Freezing Header Row (https://www.excelbanter.com/excel-programming/440419-freezing-header-row.html)

mdup

Freezing Header Row
 
Hello,

I am trying to freeze the first row of an Excel Worksheet using VB. I
have tried many different codes and none of them work, I have been getting
Null Exception Errors. Here is a piece of code that I am trying to use to
freeze the first row.

objxloutsheet = objxloutwbook.ActiveSheet
Dim FP As Excel.Window
objxloutsheet.Range("A1, Z1").Select()
FP.FreezePanes() = True

I am also not sure on how to select the first row in the FP.FreezePanes() =
True line.

Any help would be appreciated, Thanks in advance.

John[_22_]

Freezing Header Row
 
Hi
Try this:
Range("A2").Select
ActiveWindow.FreezePanes = True
HTH
John
"mdup" wrote in message
...
Hello,

I am trying to freeze the first row of an Excel Worksheet using VB. I
have tried many different codes and none of them work, I have been getting
Null Exception Errors. Here is a piece of code that I am trying to use to
freeze the first row.

objxloutsheet = objxloutwbook.ActiveSheet
Dim FP As Excel.Window
objxloutsheet.Range("A1, Z1").Select()
FP.FreezePanes() = True

I am also not sure on how to select the first row in the FP.FreezePanes() =
True line.

Any help would be appreciated, Thanks in advance.



FSt1

Freezing Header Row
 
hi
Activewindow.Freezepanes = True
objxloutsheet.Freezepanes = True should work too.

Regards
FSt1

"mdup" wrote:

Hello,

I am trying to freeze the first row of an Excel Worksheet using VB. I
have tried many different codes and none of them work, I have been getting
Null Exception Errors. Here is a piece of code that I am trying to use to
freeze the first row.

objxloutsheet = objxloutwbook.ActiveSheet
Dim FP As Excel.Window
objxloutsheet.Range("A1, Z1").Select()
FP.FreezePanes() = True

I am also not sure on how to select the first row in the FP.FreezePanes() =
True line.

Any help would be appreciated, Thanks in advance.


mdup

Freezing Header Row
 
Thanks for the reply. Freezepanes is not a member of worksheets, I am not
getting this as the error "Public member 'FreezePanes' on type 'Worksheet'
not found." The error occurs when I have the following as the code:

objxloutsheet.FreezePanes = True

"FSt1" wrote:

hi
Activewindow.Freezepanes = True
objxloutsheet.Freezepanes = True should work too.

Regards
FSt1

"mdup" wrote:

Hello,

I am trying to freeze the first row of an Excel Worksheet using VB. I
have tried many different codes and none of them work, I have been getting
Null Exception Errors. Here is a piece of code that I am trying to use to
freeze the first row.

objxloutsheet = objxloutwbook.ActiveSheet
Dim FP As Excel.Window
objxloutsheet.Range("A1, Z1").Select()
FP.FreezePanes() = True

I am also not sure on how to select the first row in the FP.FreezePanes() =
True line.

Any help would be appreciated, Thanks in advance.



All times are GMT +1. The time now is 10:23 AM.

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