Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to perform the Filter action in excel using vb script?
#1
Solved: 11 Years, 3 Months ago
I have some 10000 records in excel among this there are duplicated data availabale, i need to filter the data based on selected value,

Please help me in this regard

Thanks in Advance,
Venkat

Hi All,
With some R&d and by searching i have got up to some extent of the solution which is am able to set the filter action and now i want to select the particular value in the data

Please find the below one

Code:
set aa=Createobject("Excel.Application")
set b=aa.Workbooks.open("D:\subbu.xls")
set c=aa.worksheets("sheet2")
c.cells(1,5).autofilter
set aa=Nothing
msgbox "Done"

Thanks in advance,
Venkat
Reply
#2
Solved: 11 Years, 3 Months ago
Hi Venkat,

Try using the arguments for autofilter.
see if this works for you
Code:
c.cells(1,5).autofilter 5,"a"

Reply
#3
Solved: 11 Years, 3 Months ago
Thanks saket for replying,
i have tried with that and got the message like this
"---------------------------
Windows Script Host
---------------------------
Script: C:\Documents and Settings\venkat.batchu\Desktop\To get a value from specific row and 1coloumn from excell.vbs
Line: 5
Char: 1
Error: AutoFilter method of Range class failed
Code: 800A03EC
Source: Microsoft Office Excel

---------------------------
OK
---------------------------
"
Venkat..
Reply
#4
Solved: 11 Years, 3 Months ago
how many autofilter you have on the sheet?
use in the syntax below
c.cells(1,5).autofilter <<autofilter fileld Number>>,<<your selection criteria>>
if you have only one autofilter field in the sheet then
use c.cells(1,5).autofilter 1,"Selection criteria"

does this work now?

Reply
#5
Solved: 11 Years, 3 Months ago
Hi Saket,
Thanks for replaying which is working and if you dont mind can u please describe the cells(1,5) here what is meant by 1 and what is meant by 5
i am using blindly (1,1) with this i am getting as per my expected data
please do this favor

Thanks.........................
Reply
#6
Solved: 11 Years, 3 Months ago
when you use cells in excel spreadsheet then a cell indicates a box on a particular row and column.
So whenever you need to have an operation on any cell then you will have to provide which row and which column.
So in your code when you use cells(1,5) that indicates you are working on a cell which is on first row and column 3.

see excel vba help for more info on this.

Reply
#7
Solved: 11 Years, 3 Months ago
Thanks alot saket,
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Excel and Driver Script shipu 1 3,756 02-27-2014, 09:09 AM
Last Post: supputuri
  Filter multiple columns in excel kamalteja 0 3,756 07-08-2013, 02:28 AM
Last Post: kamalteja
  Ways to perform extraction AAB 4 4,113 06-05-2012, 09:05 PM
Last Post: supputuri
  Difference between parameter tabs in Action Properties and Action Call Properties. vibhakhandelwal 0 4,008 11-16-2011, 01:34 PM
Last Post: vibhakhandelwal
  Update a value in excel sheet during runtime & use the value later in the same script SweetyChowdhury 3 5,377 09-08-2011, 03:33 PM
Last Post: souvikghosh_diatm

Forum Jump:


Users browsing this thread: 1 Guest(s)