Trying to freeze heading rows on a sheet

J

JonWestcot

Hi all:

I'm trying to programatically freeze the heading rows on a particular
worksheet via a VBA program. All columns across the sheet should be frozen
so that, as I scroll up and down, the headings remain in place.

I know this involves a Pane object, but I can't seem to create one
programatically.

Can someone suggest a way to implement this where the row is variable yet it
encompases all the columns?

Thanks for any assistance you can send my way!

Jon
 
J

Joshua Fandango

Hi Jon,

I had trouble doing it without selecting a cell:

Sub Freeze_Columns()
Dim rVariableRange As Object
ActiveWindow.FreezePanes = False
Set rVariableRange = Range("a4")
rVariableRange.Select
ActiveWindow.FreezePanes = True
End Sub

Hope it helps,
JF
 
S

Stefi

Try something like this:

NoofRowstoFroze = 1
Range("A" & NoofRowstoFroze + 1).Select
ActiveWindow.FreezePanes = True

Regards,
Stefi


„JonWestcot†ezt írta:
 
J

JonWestcot

Hi Joshua:

Thanks for the reply. Much appreciated!

Jon


Hi Jon,

I had trouble doing it without selecting a cell:

Sub Freeze_Columns()
Dim rVariableRange As Object
ActiveWindow.FreezePanes = False
Set rVariableRange = Range("a4")
rVariableRange.Select
ActiveWindow.FreezePanes = True
End Sub

Hope it helps,
JF
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top