#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default Searching

Is there a way to have a selection of boxes each titled with a column in a
second sheet and then filter based on these. Basically, if someone types a
name in the box representing column C, is there a way to then go to the 2nd
sheet and see a pre-filtered sheet. Can this be done with multiple inputs to
filter it even more, such as a name in column C and a job in column D to get
a more defined search? Thanks
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 772
Default Searching

I wrote this code some time ago that I think is what you want, it will just
need to be adapted.

Dim lastCell As Long
Private Sub ComboBox1_Change()
Rows("1:1").Select 'this is the row number of the header for the AutoFilter
Selection.AutoFilter
If ComboBox1 < "" Then Selection.AutoFilter Field:=1,
Criteria1:=ComboBox1.Value 'change the field to the Name column

End Sub

Private Sub ComboBox2_Change()
If ComboBox2 < "" Then Selection.AutoFilter Field:=2,
Criteria1:=ComboBox2.Value 'ditto for the date
End Sub

Private Sub CommandButton1_Click()
UserForm1.Hide

End Sub

Private Sub UserForm_Initialize()

Sheets("sheet1").AutoFilterMode = False 'turns off filter

lastCell = Cells(Rows.Count, "A").End(xlUp).Row 'this is the last cell with
data, change the "A" to the column with the names

For i = 2 To lastCell ' I start with 2 because the headers are in 1
ComboBox1.AddItem (Cells(i, 1)) 'this assumes Name is in Column 1 or A
ComboBox2.AddItem (Cells(i, 2)) 'this assumes the dates are in Column 2 or B
Next

End Sub
--
-John Northwest11
Please rate when your question is answered to help us and others know what
is helpful.


"Seb Warmoth" wrote:

Is there a way to have a selection of boxes each titled with a column in a
second sheet and then filter based on these. Basically, if someone types a
name in the box representing column C, is there a way to then go to the 2nd
sheet and see a pre-filtered sheet. Can this be done with multiple inputs to
filter it even more, such as a name in column C and a job in column D to get
a more defined search? Thanks

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
Searching for #N/A [email protected] Excel Worksheet Functions 5 February 28th 07 01:23 PM
Searching, matching then searching another list based on the match A.S. Excel Discussion (Misc queries) 1 December 13th 06 05:08 AM
searching for tab Kevin R Excel Discussion (Misc queries) 3 January 16th 06 08:55 PM
Searching DQ05 Excel Worksheet Functions 1 September 24th 05 06:08 PM
Searching for "?" Bill Ridgeway New Users to Excel 3 August 3rd 05 10:35 AM


All times are GMT +1. The time now is 05:12 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"