Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA programming-autofilter function


Hi,

I have 2 worksheet= A & B
I want to filter data in worksheet A, which the criterial is the value
in certain cell in worksheet B.

I have try the below method to filter a column which contain only "0" &
"1"
Selection.AutoFilter Field:=7, Criteria1:="0"
it work..

but when i use the same command which i change the criterial to some
text, then error happen.

And i found some syntax like
Filter(sourcesrray, match[, include[, compare]])
but i dun understand the line of syntax..

pls help...

Thanks
YL Chuah


--
ylchuah
------------------------------------------------------------------------
ylchuah's Profile: http://www.excelforum.com/member.php...o&userid=25341
View this thread: http://www.excelforum.com/showthread...hreadid=388216

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default VBA programming-autofilter function

Hi Ylchuah,


I want to filter data in worksheet A, which the criterial is the value
in certain cell in worksheet B.


[cut]

but when i use the same command which i change the criterial to some
text, then error happen.


Using a text value on a second sheet as a criterion for an autofilter on a
first sheet, the following worked for me:

Public Sub Tester02A()
Dim DataSh As Worksheet
Dim CritSh As Worksheet

With ActiveWorkbook
Set DataSh = .Sheets("Sheet1")
Set CritSh = .Sheets("Sheet2")
End With

DataSh.ShowAllData

DataSh.Cells.AutoFilter _
Field:=7, _
Criteria1:="" & CritSh.Range("A1").Value

End Sub


---
Regards,
Norman



"ylchuah" wrote in
message ...

Hi,

I have 2 worksheet= A & B
I want to filter data in worksheet A, which the criterial is the value
in certain cell in worksheet B.

I have try the below method to filter a column which contain only "0" &
"1"
Selection.AutoFilter Field:=7, Criteria1:="0"
it work..

but when i use the same command which i change the criterial to some
text, then error happen.

And i found some syntax like
Filter(sourcesrray, match[, include[, compare]])
but i dun understand the line of syntax..

pls help...

Thanks
YL Chuah


--
ylchuah
------------------------------------------------------------------------
ylchuah's Profile:
http://www.excelforum.com/member.php...o&userid=25341
View this thread: http://www.excelforum.com/showthread...hreadid=388216



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming or Function? jweasl Excel Discussion (Misc queries) 7 November 16th 06 04:32 AM
WORKSHEET FUNCTION or PROGRAMMING. rml Excel Worksheet Functions 8 November 11th 06 08:55 PM
Programming a Function in VB kdp Excel Discussion (Misc queries) 0 November 30th 05 09:10 PM
Simple Programming Function?? Texins Karate Excel Programming 1 March 12th 05 04:49 PM
Function tool or programming...Help please! Sukismomma Excel Programming 5 January 28th 05 12:05 PM


All times are GMT +1. The time now is 07:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"