Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Search using Autofilter

I have a table with 11 headings. I have a form that contains option buttons
for each of these headings and a critera box. When the user clicks the
search button i need it to auto filter the desired heading by the critera
entered. This will then be copied to a new page called search results ( i
know how to do this bit). Thanks in advance for any help.
--
Cheers,
Ben

Remove your.tonsils to reply
"You only live once but if you do it right once is enough!"


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 194
Default Search using Autofilter

Hi, Ben. This is code I use to AutoFilter my spreadsheet. I use an
InputBox to get the filter criteria. You would most likely want to use the
value of the text box as the string, and put your code in the
CommandButton_Click event.

HTH
Ed

' Clear previous sort
Sheets("Sheet1").AutoFilterMode = False

With Cells
.EntireColumn.Hidden = False
.EntireRow.Hidden = False
End With

Range("A1").Select

' Choose series by letter
MyTarget = Application.InputBox("Which TIR series?")

Application.ScreenUpdating = False

' Filter for report
Selection.AutoFilter
Selection.AutoFilter Field:=3, Criteria1:="=L5-" & MyTarget & "*"

"Ben Allen" wrote in message
...
I have a table with 11 headings. I have a form that contains option

buttons
for each of these headings and a critera box. When the user clicks the
search button i need it to auto filter the desired heading by the critera
entered. This will then be copied to a new page called search results ( i
know how to do this bit). Thanks in advance for any help.
--
Cheers,
Ben

Remove your.tonsils to reply
"You only live once but if you do it right once is enough!"




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Search using Autofilter

Thanks for your help,
I have used IF functions for use with the checkboxes but get an error with
my current code. Can anyone help?
Thanks in advance, Ben

Private Sub SearchButton_Click()
Range("B3:L10").Select
'Set Field
Dim myField As Integer
If DateOp = True Then
Set myField = 1
ElseIf TourRef = True Then
Set myField = 2
ElseIf Country = True Then
Set myField = 3
ElseIf Place = True Then
Set myField = 4
ElseIf Spaces = True Then
Set myField = 10
End If
Selection.AutoFilter Field:=myFeild, Criteria1:=Search.Value,
Operator:=xlAnd

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
2007 excel autofilter change back to 2003 autofilter? jonnybrovo815 Excel Discussion (Misc queries) 1 April 19th 10 05:53 PM
Autofilter to search characters that begin with "* " Barb Reinhardt Excel Discussion (Misc queries) 1 November 16th 05 01:30 PM
Windows search in Excel with autofilter Dave Z Excel Discussion (Misc queries) 1 January 21st 05 07:44 PM
using autofilter to search 2 columns neowok[_11_] Excel Programming 6 February 19th 04 02:40 PM
Use sheet name as search string or autofilter criteria Magar Excel Programming 1 November 14th 03 01:06 PM


All times are GMT +1. The time now is 11:31 AM.

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

About Us

"It's about Microsoft Excel"