About Autofilter Method for Excel

About Autofilter Method for Excel

truewaytw
Enthusiast Enthusiast
948 Views
2 Replies
Message 1 of 3

About Autofilter Method for Excel

truewaytw
Enthusiast
Enthusiast

i want take data from excel , use 'find method like follow , i can take one cell ,
but if i want take much data via 'Autofilter like ">5.3" or ">2.3 & <5.5" ,
i don't know how to use 'Autofilter method , can anyone help me !

 

  (setq XlFil "D:\\Excel\\test.xlsx")
  (setq appXl(vlax-get-or-create-object "Excel.Application"))
  (vla-put-visible appXl :vlax-true)
  (setq objBooks(vlax-invoke-method (vlax-get-property appXl 'WorkBooks) 'Open XlFil))
  (setq objSheet(vlax-get-property objBooks 'ActiveSheet))
  (setq aftRange(vlax-get-property objSheet 'Range "D1"))
  (setq objFindRng(vlax-variant-value(vlax-get-property (vlax-get objSheet 'Columns) 'Item "D")))
  (setq objFindCell(vlax-invoke-method objFindRng 'find "5.3" aftRange -4163 2 nil nil))
  (vlax-put-property appXl 'DisplayAlerts :vlax-false)
  (vlax-invoke-method objBooks 'Close)
  (vlax-invoke-method appXl 'Quit)

0 Likes
Accepted solutions (1)
949 Views
2 Replies
Replies (2)
Message 2 of 3

Ranjit_Singh
Advisor
Advisor
Accepted solution

Maybe read the data and then filter it using AutoLISP. You would use the Autofilter only if you wish to change the excel file itself. Plus, I don't think you can only read the filtered data (after applying autofilter). The range object will still contain all the cells.

Message 3 of 3

truewaytw
Enthusiast
Enthusiast

ok , i understand , very thanks !

0 Likes