Link to home
Start Free TrialLog in
Avatar of Hecatonchires
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").Orientation = 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.AutoFit
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



Avatar of supunr
supunr

   .Range("A1").Select
    .ActiveWindow.FreezePanes = True
'    .Range("A1").Select
'    .ActiveWindow.FreezePanes = False
ASKER CERTIFIED SOLUTION
Avatar of supunr
supunr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Hecatonchires

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.