Jump to content

Recommended Posts

Posted

I am having trouble enabling AutoFilter in Excel. The VB macro looks like:

Sheets("Sheet1").Select

Range("A1").Select

Selection.AutoFilter

I am trying:

$oExcel.activesheet.Range("A1").select

$oExcel.selection.autofilter

I get a COM error though 'Unable to get the AutoFilter property of the Range class" (number 80020009)

Any help is appreciated.

Thanks

Posted (edited)

Can you verify that Cell A1 is NOT empty?

You cannot autofilter an empty (list) range.

Try this:

$oExcel.ActiveSheet.Range("A1").Autofilter

I am having trouble enabling AutoFilter in Excel. The VB macro looks like:

Sheets("Sheet1").Select

Range("A1").Select

Selection.AutoFilter

I am trying:

$oExcel.activesheet.Range("A1").select

$oExcel.selection.autofilter

I get a COM error though 'Unable to get the AutoFilter property of the Range class" (number 80020009)

Any help is appreciated.

Thanks

Edited by DaRam
Posted

I am having trouble enabling AutoFilter in Excel. The VB macro looks like:

Sheets("Sheet1").Select

Range("A1").Select

Selection.AutoFilter

I am trying:

$oExcel.activesheet.Range("A1").select

$oExcel.selection.autofilter

I get a COM error though 'Unable to get the AutoFilter property of the Range class" (number 80020009)

Any help is appreciated.

Thanks

This works for me...

$myExcel = ObjCreate("Excel.Application")
With $myExcel
        .Visible = True
        .WorkBooks.Open("C:\temp.xls")
EndWith

$myExcel.Cells(1,1).Select
$myExcel.Selection.Autofilter
  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...