none
Excel Formula for Unique Records Only RRS feed

  • Question

  • I am writing a vb.net app that uses Imports Microsoft.Office.Interop.Excel. 

    Example:

            MyExcel.Workbooks.Open("FileName.xls")
            MyExcel.Sheets("Sheet1").activate()
            MyExcel.Visible = False
    
            MyExcel.Range("A1").Activate()
            MyExcel.Range("A1").NumberFormat = "0"
            MyExcel.ActiveCell.Formula = "=COUNTA(A3:A65000)"
            TextBox1.Text = MyExcel.Range("A1").Text
            
     	MyExcel.ActiveWorkbook.Close(SaveChanges:=False)
            MyExcel.Quit()

    I open excel and pass formulas and get data from the spreadsheet.  I need a way to do a Advanced Filer "Unique records only" from a formula.  something like this "Range("A3:B65000").AdvancedFilter Action:=xlFilterInPlace, Unique:=True"  B65000 is max it's sometime 1,000 or 50,000 but in a valid formula not a macro.   any help is greatly appreciated.

     


    Work Smarter Not Harder

    Wednesday, January 7, 2015 5:05 PM

Answers

All replies