Hecatonchires
asked on
VB6 & Excel - Autofilter and freeze panes
Generating a spreadsheet via code.
Spreadsheet builds fine. After the data is inserted, I run some formatting.
The data is inserted into two sheets, xlSheetFull and xlSheetShort. The Short sheet is a summary listing, with some of the fields left out.
'formatting
With xlSheetFull
.Cells(1, 1).Font.Bold = True
.Cells(1, 2).Font.Bold = True
.Cells(1, 1).Font.Size = 14
.Cells(1, 1).Font.Size = 12
.Range("a2:ae2").Font.Bold = True
.Range("p2:ae2").Orientati on = 90
.Range("f3:f" & lRow).NumberFormat = "dd/mm/yyyy"
.Range("n3:n" & lRow).NumberFormat = "dd/mm/yyyy"
.Range("o3:o" & lRow).NumberFormat = "dd/mm/yyyy"
.Range("a:ae").Columns.Aut oFit
End With
Now, I want to freeze panes and get an autofilter on.
The column headings are in row 2
I can't seem to figure out the syntax to freeze the panes below row 2, and turn on the filter buttons in row 2. Especially grateful if it can be fitted in between the With..end with
Spreadsheet builds fine. After the data is inserted, I run some formatting.
The data is inserted into two sheets, xlSheetFull and xlSheetShort. The Short sheet is a summary listing, with some of the fields left out.
'formatting
With xlSheetFull
.Cells(1, 1).Font.Bold = True
.Cells(1, 2).Font.Bold = True
.Cells(1, 1).Font.Size = 14
.Cells(1, 1).Font.Size = 12
.Range("a2:ae2").Font.Bold
.Range("p2:ae2").Orientati
.Range("f3:f" & lRow).NumberFormat = "dd/mm/yyyy"
.Range("n3:n" & lRow).NumberFormat = "dd/mm/yyyy"
.Range("o3:o" & lRow).NumberFormat = "dd/mm/yyyy"
.Range("a:ae").Columns.Aut
End With
Now, I want to freeze panes and get an autofilter on.
The column headings are in row 2
I can't seem to figure out the syntax to freeze the panes below row 2, and turn on the filter buttons in row 2. Especially grateful if it can be fitted in between the With..end with
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Well, autofilter works
Freeze panes dies - run time error 1004. I think It's due to runnning excel hidden. I'm prepared to move on.
Freeze panes dies - run time error 1004. I think It's due to runnning excel hidden. I'm prepared to move on.
.ActiveWindow.FreezePanes = True
' .Range("A1").Select
' .ActiveWindow.FreezePanes = False