Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,670
Default 2 parrameters to filter

Hello all,

Here is macro for my sheet to do a filter search with one parrameter "Mix
Type". Now I want it to search by 2 criterias first is "Mix Type" second is
"Contract #" and I want this to be done anytime a search is done. Any help
would be appreciated.

ERic

Sub RemoveDuplicates_Mix_Type()

Dim allcells As Range, cell As Range
Dim nodupes As New Collection

On Error Resume Next
For Each cell In Range("B27:B500")
nodupes.Add cell.Value, CStr(cell.Value)
Next cell
On Error GoTo 0

For Each item In nodupes
UserForm3.ListBox1.AddItem item
Next item

UserForm3.Show

Sheets("test Database").Select
Range("A1").Value = 1

Sheets("test Database_mix").Select
Range("B2").Value = 1


Then in the list box is:

Private Sub ListBox1_Click()

Range("d6").Value = ListBox1


For i = 0 To UserForm3.ListBox1.ListCount - 1
If UserForm3.ListBox1.Selected(i) Then

Dim ws As Worksheet
Dim rng As Range
Dim rng2 As Range

With Application
.ScreenUpdating = False
.EnableEvents = False
End With

Set ws = Sheets("Test Database")

Set rng = ws.Range("B26:AG500")

ws.AutoFilterMode = False

rng.AutoFilter field:=1, Criteria1:="=" & ws.Range("D6").Value

ws.AutoFilter.Range.Copy


Sheets("test database_mix").Select

Range("C500").Select
Selection.End(xlUp).Select
ActiveCell.Offset(1, -2).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

ws.AutoFilterMode = False

With Application
.ScreenUpdating = True
.EnableEvents = True
End With

End If
Next


End Sub



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
Filter PivotTable dropdown items to match report filter Catherine D Excel Discussion (Misc queries) 1 August 16th 08 12:12 AM
Passing parrameters when calling a sub from by clicking an object Balmain Bushwalker[_2_] Excel Programming 0 October 25th 07 01:13 AM
filter: how to print filter list options in dropdown box help please Excel Discussion (Misc queries) 2 October 17th 07 01:53 AM
"Criteria Range" in the "Data/Filter/Advanced Filter" to select Du TC Excel Worksheet Functions 1 May 12th 05 02:06 AM
How to set multiple filter values for a filter in the page fields Simon Lenn Excel Programming 1 December 29th 03 09:35 PM


All times are GMT +1. The time now is 12:38 PM.

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"